pub struct DataObj<'parent> { /* private fields */ }Expand description
A smart pointer to obs_data_t
Implementations§
Source§impl 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§
Source§impl FromDataItem for DataObj<'_>
impl FromDataItem for DataObj<'_>
fn typ() -> DataType
Source§unsafe 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
Source§unsafe 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
Source§impl PtrWrapper for DataObj<'_>
impl PtrWrapper for DataObj<'_>
type Pointer = obs_data
Source§unsafe 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
Source§fn into_raw(self) -> *mut Self::Pointer
fn into_raw(self) -> *mut Self::Pointer
Consumes the wrapper and transfers ownershop to the pointer Read more
Source§fn 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> Freeze for DataObj<'parent>
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§
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