pub struct ObsData { /* private fields */ }Expand description
Contains obs_data and its related strings. Note that
this struct prevents string pointers from being freed
by keeping them owned.
Cloning ObsData is blocking and will create a new ObsData instance. Recommended is to use ObsData::full_clone() instead.
§Panics
If the underlying JSON representation can not be parsed.
Implementations§
Source§impl ObsData
impl ObsData
Sourcepub fn new(runtime: ObsRuntime) -> Result<Self, ObsError>
pub fn new(runtime: ObsRuntime) -> Result<Self, ObsError>
Creates a new empty ObsData wrapper for the
libobs obs_data data structure.
ObsData can then be populated using the set
functions, which take ownership of the
ObsString types to prevent them from being
dropped prematurely. This makes it safer than
using obs_data directly from libobs.
pub fn bulk_update(&mut self) -> ObsDataUpdater
pub fn from_json(json: &str, runtime: ObsRuntime) -> Result<Self, ObsError>
Sourcepub fn into_immutable(self) -> ImmutableObsData
pub fn into_immutable(self) -> ImmutableObsData
Converts this ObsData into an ImmutableObsData.
Transfers the pointer without cloning.
Trait Implementations§
Source§impl From<ObsData> for ImmutableObsData
impl From<ObsData> for ImmutableObsData
Source§impl ObsDataGetters for ObsData
impl ObsDataGetters for ObsData
fn get_string<T: Into<ObsString> + Send + Sync>( &self, key: T, ) -> Result<Option<String>, ObsError>
fn get_int<T: Into<ObsString> + Sync + Send>( &self, key: T, ) -> Result<Option<i64>, ObsError>
fn get_bool<T: Into<ObsString> + Sync + Send>( &self, key: T, ) -> Result<Option<bool>, ObsError>
fn get_double<T: Into<ObsString> + Sync + Send>( &self, key: T, ) -> Result<Option<f64>, ObsError>
fn get_json(&self) -> Result<String, ObsError>
Source§impl ObsDataPointers for ObsData
impl ObsDataPointers for ObsData
fn runtime(&self) -> &ObsRuntime
fn as_ptr(&self) -> SmartPointerSendable<*mut obs_data_t>
Source§impl ObsDataSetters for ObsData
impl ObsDataSetters for ObsData
Source§fn set_string<T: Into<ObsString> + Send + Sync, K: Into<ObsString> + Send + Sync>(
&mut self,
key: T,
value: K,
) -> Result<&mut Self, ObsError>
fn set_string<T: Into<ObsString> + Send + Sync, K: Into<ObsString> + Send + Sync>( &mut self, key: T, value: K, ) -> Result<&mut Self, ObsError>
Sets a string in
obs_data and stores it so
it in ObsData does not get freed.Source§fn set_int<T: Into<ObsString> + Sync + Send>(
&mut self,
key: T,
value: i64,
) -> Result<&mut Self, ObsError>
fn set_int<T: Into<ObsString> + Sync + Send>( &mut self, key: T, value: i64, ) -> Result<&mut Self, ObsError>
Sets an int in
obs_data and stores the key
in ObsData so it does not get freed.Auto Trait Implementations§
impl Freeze for ObsData
impl !RefUnwindSafe for ObsData
impl Send for ObsData
impl Sync for ObsData
impl Unpin for ObsData
impl !UnwindSafe for ObsData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more