#[repr(C)]pub struct AttrValue(attr_value_t);
Expand description
Owned attribute value
Tuple Fields§
§0: attr_value_t
Implementations§
source§impl AttrValue
impl AttrValue
sourcepub fn string_unchecked(s: &str) -> Self
pub fn string_unchecked(s: &str) -> Self
Construct a string AttrValue
without checking for null bytes in the input string.
This method will panic if s
contains a null byte, but is used to simplify some
APIs to avoid requiring a Result
type.
sourcepub fn object(o: *mut ConfObject) -> Self
pub fn object(o: *mut ConfObject) -> Self
Construct an object AttrValue
source§impl AttrValue
impl AttrValue
sourcepub fn as_mut_ptr(&mut self) -> *mut attr_value_t
pub fn as_mut_ptr(&mut self) -> *mut attr_value_t
Get a mutable pointer to the inner attr value
sourcepub fn size(&self) -> u32
pub fn size(&self) -> u32
Get the size of the attr value. This is only non-zero in cases where the value is a collection (list, dict) or data type
sourcepub fn is_invalid(&self) -> bool
pub fn is_invalid(&self) -> bool
Get whether the value is invalid type
sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Get whether the value is integer type
sourcepub fn is_unsigned(&self) -> bool
pub fn is_unsigned(&self) -> bool
Get whether the value is unsigned integer type
sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Get whether the value is boolean type
sourcepub fn is_floating(&self) -> bool
pub fn is_floating(&self) -> bool
Get whether the value is floating type
sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Get the value as an integer, if it is one, or None
otherwise.
sourcepub fn as_unsigned(&self) -> Option<u64>
pub fn as_unsigned(&self) -> Option<u64>
Get the value as an unsigned integer, if it is one, or None
otherwise.
sourcepub fn as_signed(&self) -> Option<i64>
pub fn as_signed(&self) -> Option<i64>
Get the value as a signed integer, if it is one, or None
otherwise.
sourcepub fn as_boolean(&self) -> Option<bool>
pub fn as_boolean(&self) -> Option<bool>
Get the value as a boolean, if it is one, or None
otherwise.
sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
Get the value as a string, if it is one, or None
otherwise.
sourcepub fn as_floating(&self) -> Option<f64>
pub fn as_floating(&self) -> Option<f64>
Get the value as a float, if it is one, or None
otherwise.
sourcepub fn as_object(&self) -> Option<*mut ConfObject>
pub fn as_object(&self) -> Option<*mut ConfObject>
Get the value as a ConfObject
, if it is one, or None
otherwise.
sourcepub fn as_data<T>(&self) -> Option<T>where
T: Clone,
pub fn as_data<T>(&self) -> Option<T>where
T: Clone,
Get the value as data, if it is one, or None
otherwise. Data is copied, the
AttrValue
maintains ownership.
sourcepub fn as_list_checked<T>(&self) -> Result<Option<Vec<T>>>
pub fn as_list_checked<T>(&self) -> Result<Option<Vec<T>>>
Get the value as a list, if it is one, or None
otherwise. Data is copied, the
AttrValue
maintains ownership. Use as_list
if you
sourcepub fn as_list<T>(&self) -> Option<Vec<T>>
pub fn as_list<T>(&self) -> Option<Vec<T>>
Get the value as a list, if it is one, or None
otherwise. Data is copied, the
AttrValue
maintains ownership. Use as_list
if you
sourcepub fn as_heterogeneous_list(&self) -> Option<Vec<AttrValueType>>
pub fn as_heterogeneous_list(&self) -> Option<Vec<AttrValueType>>
Get the value as a list, if it is one, or None
otherwise. Data is copied, the
AttrValue
maintains ownership.
sourcepub fn as_dict_checked<T, U>(&self) -> Result<Option<BTreeMap<T, U>>>
pub fn as_dict_checked<T, U>(&self) -> Result<Option<BTreeMap<T, U>>>
Get the value as a dict, if it is one, or None
otherwise. Data is copied, the
AttrValue
maintains ownership.
sourcepub fn as_dict<T, U>(&self) -> Option<BTreeMap<T, U>>
pub fn as_dict<T, U>(&self) -> Option<BTreeMap<T, U>>
Get the value as a dict, if it is one, or None
otherwise. Data is copied, the
AttrValue
maintains ownership.
sourcepub fn as_heterogeneous_dict(
&self,
) -> Result<Option<BTreeMap<AttrValueType, AttrValueType>>>
pub fn as_heterogeneous_dict( &self, ) -> Result<Option<BTreeMap<AttrValueType, AttrValueType>>>
Get the value as a dict, if it is one, or None
otherwise. Data is copied, the
AttrValue
maintains ownership.
Trait Implementations§
source§impl From<*mut conf_object> for AttrValue
impl From<*mut conf_object> for AttrValue
source§fn from(value: *mut ConfObject) -> Self
fn from(value: *mut ConfObject) -> Self
source§impl From<AttrValue> for AttrValueType
impl From<AttrValue> for AttrValueType
source§impl From<AttrValueType> for AttrValue
impl From<AttrValueType> for AttrValue
source§fn from(value: AttrValueType) -> Self
fn from(value: AttrValueType) -> Self
impl Copy for AttrValue
impl Send for AttrValue
impl Sync for AttrValue
Auto Trait Implementations§
impl Freeze for AttrValue
impl RefUnwindSafe for AttrValue
impl Unpin for AttrValue
impl UnwindSafe for AttrValue
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)