Struct simics::api::base::attr_value::AttrValue

source ·
#[repr(C)]
pub struct AttrValue(attr_value_t);
Expand description

Owned attribute value

Tuple Fields§

§0: attr_value_t

Implementations§

source§

impl AttrValue

source

pub fn nil() -> Self

Construct a nil AttrValue

source

pub fn invalid() -> Self

Construct an intentionally invalid AttrValue

source

pub fn signed(s: i64) -> Self

Construct a signed AttrValue

source

pub fn unsigned(u: u64) -> Self

Construct an unsigned AttrValue

source

pub fn boolean(b: bool) -> Self

Construct a boolean AttrValue

source

pub fn string(s: &str) -> Result<Self>

Construct a string AttrValue

source

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.

source

pub fn floating(f: f64) -> Self

Construct a floating AttrValue

source

pub fn object(o: *mut ConfObject) -> Self

Construct an object AttrValue

source

pub fn data<T>(d: T) -> Self
where T: Into<Box<[u8]>>,

Construct a data AttrValue

source

pub fn list(length: usize) -> Result<Self>

Construct an empty AttrValue list of a certain length. This should typically not be used, a Vec<T> where T: TryInto<AttrValue> can be converted to an AttrValue with try_into.

source

pub fn dict(size: usize) -> Result<Self>

Construct an empty AttrValue dict of a certain size. This should typically not be used, a BTreeMap<T, U> where T: TryInto<AttrValue>, U: TryInto<AttrValue> can be converted to an AttrValue with try_into.

source§

impl AttrValue

source

pub fn as_ptr(&self) -> *const attr_value_t

Get a constant pointer to the inner attr value

source

pub fn as_mut_ptr(&mut self) -> *mut attr_value_t

Get a mutable pointer to the inner attr value

source

pub fn kind(&self) -> AttrKind

Get the kind of the attr value

source

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

source

pub fn is_invalid(&self) -> bool

Get whether the value is invalid type

source

pub fn is_nil(&self) -> bool

Get whether the value is nil type

source

pub fn is_integer(&self) -> bool

Get whether the value is integer type

source

pub fn is_unsigned(&self) -> bool

Get whether the value is unsigned integer type

source

pub fn is_signed(&self) -> bool

Get whether the value is unsigned integer type

source

pub fn is_boolean(&self) -> bool

Get whether the value is boolean type

source

pub fn is_string(&self) -> bool

Get whether the value is string type

source

pub fn is_floating(&self) -> bool

Get whether the value is floating type

source

pub fn is_object(&self) -> bool

Get whether the value is object type

source

pub fn is_data(&self) -> bool

Get whether the value is data type

source

pub fn is_list(&self) -> bool

Get whether the value is list type

source

pub fn is_dict(&self) -> bool

Get whether the value is dict type

source

pub fn as_integer(&self) -> Option<i64>

Get the value as an integer, if it is one, or None otherwise.

source

pub fn as_unsigned(&self) -> Option<u64>

Get the value as an unsigned integer, if it is one, or None otherwise.

source

pub fn as_signed(&self) -> Option<i64>

Get the value as a signed integer, if it is one, or None otherwise.

source

pub fn as_boolean(&self) -> Option<bool>

Get the value as a boolean, if it is one, or None otherwise.

source

pub fn as_string(&self) -> Option<String>

Get the value as a string, if it is one, or None otherwise.

source

pub fn as_floating(&self) -> Option<f64>

Get the value as a float, if it is one, or None otherwise.

source

pub fn as_object(&self) -> Option<*mut ConfObject>

Get the value as a ConfObject, if it is one, or None otherwise.

source

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.

source

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

source

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

source

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.

source

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.

source

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.

source

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 Clone for AttrValue

source§

fn clone(&self) -> AttrValue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AttrValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&OrderedFloat<f32>> for AttrValue

source§

fn from(value: &OrderedFloat<f32>) -> Self

Converts to this type from the input type.
source§

impl From<&OrderedFloat<f64>> for AttrValue

source§

fn from(value: &OrderedFloat<f64>) -> Self

Converts to this type from the input type.
source§

impl From<&f32> for AttrValue

source§

fn from(value: &f32) -> AttrValue

Converts to this type from the input type.
source§

impl From<&i16> for AttrValue

source§

fn from(value: &i16) -> AttrValue

Converts to this type from the input type.
source§

impl From<&i32> for AttrValue

source§

fn from(value: &i32) -> AttrValue

Converts to this type from the input type.
source§

impl From<&i8> for AttrValue

source§

fn from(value: &i8) -> AttrValue

Converts to this type from the input type.
source§

impl From<&isize> for AttrValue

source§

fn from(value: &isize) -> AttrValue

Converts to this type from the input type.
source§

impl From<&str> for AttrValue

source§

fn from(value: &str) -> Self

Converts to this type from the input type.
source§

impl From<&u16> for AttrValue

source§

fn from(value: &u16) -> AttrValue

Converts to this type from the input type.
source§

impl From<&u32> for AttrValue

source§

fn from(value: &u32) -> AttrValue

Converts to this type from the input type.
source§

impl From<&u8> for AttrValue

source§

fn from(value: &u8) -> AttrValue

Converts to this type from the input type.
source§

impl From<&usize> for AttrValue

source§

fn from(value: &usize) -> AttrValue

Converts to this type from the input type.
source§

impl From<*mut conf_object> for AttrValue

source§

fn from(value: *mut ConfObject) -> Self

Converts to this type from the input type.
source§

impl From<AttrValue> for AttrValueType

source§

fn from(value: AttrValue) -> Self

Converts to this type from the input type.
source§

impl From<AttrValue> for attr_value_t

source§

fn from(value: AttrValue) -> Self

Converts to this type from the input type.
source§

impl From<AttrValueType> for AttrValue

source§

fn from(value: AttrValueType) -> Self

Converts to this type from the input type.
source§

impl From<OrderedFloat<f32>> for AttrValue

source§

fn from(value: OrderedFloat<f32>) -> Self

Converts to this type from the input type.
source§

impl From<OrderedFloat<f64>> for AttrValue

source§

fn from(value: OrderedFloat<f64>) -> Self

Converts to this type from the input type.
source§

impl From<String> for AttrValue

source§

fn from(value: String) -> Self

Converts to this type from the input type.
source§

impl From<attr_value> for AttrValue

source§

fn from(value: attr_value_t) -> Self

Converts to this type from the input type.
source§

impl From<bool> for AttrValue

source§

fn from(value: bool) -> Self

Converts to this type from the input type.
source§

impl From<f32> for AttrValue

source§

fn from(value: f32) -> AttrValue

Converts to this type from the input type.
source§

impl From<f64> for AttrValue

source§

fn from(value: f64) -> Self

Converts to this type from the input type.
source§

impl From<i16> for AttrValue

source§

fn from(value: i16) -> AttrValue

Converts to this type from the input type.
source§

impl From<i32> for AttrValue

source§

fn from(value: i32) -> AttrValue

Converts to this type from the input type.
source§

impl From<i64> for AttrValue

source§

fn from(value: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for AttrValue

source§

fn from(value: i8) -> AttrValue

Converts to this type from the input type.
source§

impl From<isize> for AttrValue

source§

fn from(value: isize) -> AttrValue

Converts to this type from the input type.
source§

impl From<u16> for AttrValue

source§

fn from(value: u16) -> AttrValue

Converts to this type from the input type.
source§

impl From<u32> for AttrValue

source§

fn from(value: u32) -> AttrValue

Converts to this type from the input type.
source§

impl From<u64> for AttrValue

source§

fn from(value: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for AttrValue

source§

fn from(value: u8) -> AttrValue

Converts to this type from the input type.
source§

impl From<usize> for AttrValue

source§

fn from(value: usize) -> AttrValue

Converts to this type from the input type.
source§

impl<T, U> TryFrom<&[(T, U)]> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &[(T, U)]) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<&[T]> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &[T]) -> Result<Self>

Performs the conversion.
source§

impl<T, U> TryFrom<AttrValue> for BTreeMap<T, U>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<AttrValue> for BTreeSet<T>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T, U> TryFrom<AttrValue> for HashMap<T, U>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<AttrValue> for HashSet<T>
where T: TryFrom<AttrValue> + Eq + Hash + Clone, Error: From<<T as TryFrom<AttrValue>>::Error>,

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T, U> TryFrom<AttrValue> for Option<BTreeMap<T, U>>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<AttrValue> for Option<BTreeSet<T>>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T, U> TryFrom<AttrValue> for Option<HashMap<T, U>>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<AttrValue> for Option<HashSet<T>>
where T: TryFrom<AttrValue> + Eq + Hash + Clone, Error: From<<T as TryFrom<AttrValue>>::Error>,

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<String>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<AttrValue> for Option<Vec<T>>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<bool>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<f32>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<f64>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<i16>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<i32>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<i64>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<i8>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<isize>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<u16>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<u32>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<u64>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<u8>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for Option<usize>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for PathBuf

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for String

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<AttrValue> for Vec<T>

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for bool

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for f32

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for f64

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for i16

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for i32

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for i64

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for i8

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for isize

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for u16

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for u32

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for u64

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for u8

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<AttrValue> for usize

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: AttrValue) -> Result<Self>

Performs the conversion.
source§

impl<T, U> TryFrom<BTreeMap<T, U>> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: BTreeMap<T, U>) -> Result<Self>

Performs the conversion.
source§

impl<T, U> TryFrom<BTreeSet<(T, U)>> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: BTreeSet<(T, U)>) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<BTreeSet<T>> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: BTreeSet<T>) -> Result<Self>

Performs the conversion.
source§

impl<T, U> TryFrom<HashMap<T, U>> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: HashMap<T, U>) -> Result<Self>

Performs the conversion.
source§

impl<T, U> TryFrom<HashSet<(T, U)>> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: HashSet<(T, U)>) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<HashSet<T>> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: HashSet<T>) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Option<T>> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Option<T>) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<PathBuf> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: PathBuf) -> Result<Self>

Performs the conversion.
source§

impl<T, U> TryFrom<Vec<(T, U)>> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Vec<(T, U)>) -> Result<Self>

Performs the conversion.
source§

impl<T> TryFrom<Vec<T>> for AttrValue

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Vec<T>) -> Result<Self>

Performs the conversion.
source§

impl Copy for AttrValue

source§

impl Send for AttrValue

source§

impl Sync for AttrValue

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.