pub struct Variant(/* private fields */);Expand description
Wrapper for
UA_Variant
from open62541_sys.
This owns the wrapped data. When the wrapper is dropped, the inner value is cleaned up
with UA_clear() to release dynamically allocated memory held by the value.
Implementations§
Source§impl Variant
impl Variant
pub fn with_scalar<T: DataType>(self, value: &T) -> Self
Sourcepub fn type_id(&self) -> Option<&NodeId>
pub fn type_id(&self) -> Option<&NodeId>
Gets data type’s node ID.
Returns None when the variant is empty.
Sourcepub fn value_type(&self) -> Option<ValueType>
pub fn value_type(&self) -> Option<ValueType>
Gets value type.
Returns None when the variant is empty.
pub fn is_empty(&self) -> bool
pub fn is_scalar(&self) -> bool
pub fn as_scalar<T>(&self) -> Option<&T>where
T: DataType,
pub fn to_scalar<T>(&self) -> Option<T>where
T: DataType,
pub fn into_scalar<T>(self) -> Option<T>where
T: DataType,
pub fn to_array<T: DataType>(&self) -> Option<Array<T>>
pub fn to_value(&self) -> VariantValue
pub fn json(&self) -> Option<Value>
Trait Implementations§
Source§impl DataType for Variant
impl DataType for Variant
Source§type Inner = UA_Variant
type Inner = UA_Variant
Inner type. Read more
Source§unsafe fn from_raw(src: Self::Inner) -> Self
unsafe fn from_raw(src: Self::Inner) -> Self
Creates wrapper by taking ownership of value. Read more
Source§fn take_raw(src: &mut Self::Inner) -> Self
fn take_raw(src: &mut Self::Inner) -> Self
Creates wrapper by moving value from
src. Read moreSource§fn clone_into_raw(&self, dst: &mut Self::Inner)
fn clone_into_raw(&self, dst: &mut Self::Inner)
Clones value into
dst. Read moreSource§fn move_into_raw(self, dst: &mut Self::Inner)
fn move_into_raw(self, dst: &mut Self::Inner)
Moves value into
dst, giving up ownership. Read moreSource§unsafe fn to_raw_copy(this: &Self) -> Self::Inner
unsafe fn to_raw_copy(this: &Self) -> Self::Inner
Creates copy without giving up ownership. Read more
Source§unsafe fn as_mut(&mut self) -> &mut Self::Inner
unsafe fn as_mut(&mut self) -> &mut Self::Inner
Returns exclusive reference to value. Read more
impl Eq for Variant
Source§impl Ord for Variant
impl Ord for Variant
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Variant
impl PartialOrd for Variant
impl Send for Variant
impl Sync for Variant
Auto Trait Implementations§
impl Freeze for Variant
impl RefUnwindSafe for Variant
impl Unpin for Variant
impl UnsafeUnpin for Variant
impl UnwindSafe for Variant
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DataTypeExt for Twhere
T: DataType,
impl<T> DataTypeExt for Twhere
T: DataType,
Source§fn from_inner(value: <T as DataTypeExt>::Inner) -> Result<T, Error>
fn from_inner(value: <T as DataTypeExt>::Inner) -> Result<T, Error>
Creates instance for inner type. Read more
Source§fn into_inner(self) -> <T as DataTypeExt>::Inner
fn into_inner(self) -> <T as DataTypeExt>::Inner
Returns inner type representation.