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.
Update: The strings are actually copied by obs itself, we don’t need to store them
Implementations§
Source§impl ObsData
impl ObsData
Sourcepub async fn new(runtime: ObsRuntime) -> Result<Self, ObsError>
pub async 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 async fn set_string<T: Into<ObsString> + Send + Sync, K: Into<ObsString> + Send + Sync>(
&mut self,
key: T,
value: K,
) -> Result<&mut Self, ObsError>
pub async 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 async fn set_int<T: Into<ObsString> + Sync + Send>(
&mut self,
key: T,
value: i64,
) -> Result<&mut Self, ObsError>
pub async 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 async fn set_bool<T: Into<ObsString> + Sync + Send>(
&mut self,
key: T,
value: bool,
) -> Result<&mut Self, ObsError>
pub async 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 async fn set_double<T: Into<ObsString> + Sync + Send>(
&mut self,
key: T,
value: f64,
) -> Result<&mut Self, ObsError>
pub async 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.