Struct obs_wrapper::data::DataObj
source · [−]pub struct DataObj<'parent> { /* private fields */ }Expand description
A smart pointer to obs_data_t
Implementations
sourceimpl DataObj<'_>
impl DataObj<'_>
sourcepub fn from_json(json_str: impl Into<ObsString>) -> Option<Self>
pub fn from_json(json_str: impl Into<ObsString>) -> Option<Self>
Loads data into a object from a JSON string.
sourcepub fn from_json_file(
json_file: impl Into<ObsString>,
backup_ext: impl Into<Option<ObsString>>
) -> Option<Self>
pub fn from_json_file(
json_file: impl Into<ObsString>,
backup_ext: impl Into<Option<ObsString>>
) -> Option<Self>
Loads data into a object from a JSON file.
backup_ext: optional backup file path in case the original file is bad.
sourcepub fn get<T: FromDataItem>(&self, name: impl Into<ObsString>) -> Option<T>
pub fn get<T: FromDataItem>(&self, name: impl Into<ObsString>) -> Option<T>
Fetches a property from this object. Numbers are implicitly casted.
sourcepub fn set_default<T: FromDataItem>(
&mut self,
name: impl Into<ObsString>,
value: impl Into<T>
)
pub fn set_default<T: FromDataItem>(
&mut self,
name: impl Into<ObsString>,
value: impl Into<T>
)
pub fn remove(&mut self, name: impl Into<ObsString>)
Trait Implementations
sourceimpl FromDataItem for DataObj<'_>
impl FromDataItem for DataObj<'_>
fn typ() -> DataType
sourceunsafe fn from_item_unchecked(item: *mut obs_data_item_t) -> Self
unsafe fn from_item_unchecked(item: *mut obs_data_item_t) -> Self
Safety Read more
sourceunsafe fn set_default_unchecked(obj: *mut obs_data_t, name: ObsString, val: Self)
unsafe fn set_default_unchecked(obj: *mut obs_data_t, name: ObsString, val: Self)
Safety Read more
sourceimpl PtrWrapper for DataObj<'_>
impl PtrWrapper for DataObj<'_>
type Pointer = obs_data
sourceunsafe fn from_raw(raw: *mut Self::Pointer) -> Self
unsafe fn from_raw(raw: *mut Self::Pointer) -> Self
Wraps the pointer into a owned wrapper. Read more
sourcefn into_raw(self) -> *mut Self::Pointer
fn into_raw(self) -> *mut Self::Pointer
Consumes the wrapper and transfers ownershop to the pointer Read more
sourcefn as_ptr_mut(&mut self) -> *mut Self::Pointer
fn as_ptr_mut(&mut self) -> *mut Self::Pointer
Returns the inner pointer (mutable version).
Auto Trait Implementations
impl<'parent> RefUnwindSafe for DataObj<'parent>
impl<'parent> !Send for DataObj<'parent>
impl<'parent> !Sync for DataObj<'parent>
impl<'parent> Unpin for DataObj<'parent>
impl<'parent> UnwindSafe for DataObj<'parent>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more