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
Sourcepub fn as_ptr(&self) -> Sendable<*mut obs_data>
pub fn as_ptr(&self) -> Sendable<*mut obs_data>
Returns a pointer to the raw obs_data
represented by ObsData.
Sourcepub fn set_string<T: Into<ObsString> + Send + Sync, K: Into<ObsString> + Send + Sync>(
&mut self,
key: T,
value: K,
) -> Result<&mut Self, ObsError>
pub 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.
Sourcepub fn set_int<T: Into<ObsString> + Sync + Send>(
&mut self,
key: T,
value: i64,
) -> Result<&mut Self, ObsError>
pub 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.
Sourcepub fn set_bool<T: Into<ObsString> + Sync + Send>(
&mut self,
key: T,
value: bool,
) -> Result<&mut Self, ObsError>
pub fn set_bool<T: Into<ObsString> + Sync + Send>( &mut self, key: T, value: bool, ) -> Result<&mut Self, ObsError>
Sets a bool in obs_data and stores the key
in ObsData so it does not get freed.
Sourcepub fn set_double<T: Into<ObsString> + Sync + Send>(
&mut self,
key: T,
value: f64,
) -> Result<&mut Self, ObsError>
pub fn set_double<T: Into<ObsString> + Sync + Send>( &mut self, key: T, value: f64, ) -> Result<&mut Self, ObsError>
Sets a double in obs_data and stores the key
in ObsData so it does not get freed.