[][src]Enum opcua_server::prelude::Variant

pub enum Variant {
    Empty,
    Boolean(bool),
    SByte(i8),
    Byte(u8),
    Int16(i16),
    UInt16(u16),
    Int32(i32),
    UInt32(u32),
    Int64(i64),
    UInt64(u64),
    Float(f32),
    Double(f64),
    String(UAString),
    DateTime(Box<DateTime>),
    Guid(Box<Guid>),
    StatusCode(StatusCode),
    ByteString(ByteString),
    XmlElement(UAString),
    QualifiedName(Box<QualifiedName>),
    LocalizedText(Box<LocalizedText>),
    NodeId(Box<NodeId>),
    ExpandedNodeId(Box<ExpandedNodeId>),
    ExtensionObject(Box<ExtensionObject>),
    Array(Box<Array>),
}

A Variant holds built-in OPC UA data types, including single and multi dimensional arrays, data values and extension objects.

As variants may be passed around a lot on the stack, Boxes are used for more complex types to keep the size of this type down a bit, especially when used in arrays.

Variants

Empty

Empty type has no value. It is equivalent to a Null value (part 6 5.1.6)

Boolean(bool)

Boolean

SByte(i8)

Signed byte

Byte(u8)

Unsigned byte

Int16(i16)

Signed 16-bit int

UInt16(u16)

Unsigned 16-bit int

Int32(i32)

Signed 32-bit int

UInt32(u32)

Unsigned 32-bit int

Int64(i64)

Signed 64-bit int

UInt64(u64)

Unsigned 64-bit int

Float(f32)

Float

Double(f64)

Double

String(UAString)

String

DateTime(Box<DateTime>)

DateTime

Guid(Box<Guid>)

Guid

StatusCode(StatusCode)

StatusCode

ByteString(ByteString)

ByteString

XmlElement(UAString)

XmlElement

QualifiedName(Box<QualifiedName>)

QualifiedName

LocalizedText(Box<LocalizedText>)

LocalizedText

NodeId(Box<NodeId>)

NodeId

ExpandedNodeId(Box<ExpandedNodeId>)

ExpandedNodeId

ExtensionObject(Box<ExtensionObject>)

ExtensionObject

Array(Box<Array>)

Single dimension array which can contain any scalar type, all the same type. Nested arrays will be rejected.

Implementations

impl Variant[src]

pub fn test_encoding_flag(encoding_mask: u8, data_type_id: DataTypeId) -> bool[src]

Test the flag (convenience method)

pub fn cast(&self, target_type: VariantTypeId) -> Variant[src]

Performs an EXPLICIT cast from one type to another. This will first attempt an implicit conversion and only then attempt to cast. Casting is potentially lossy.

pub fn convert(&self, target_type: VariantTypeId) -> Variant[src]

Performs an IMPLICIT conversion from one type to another

pub fn type_id(&self) -> VariantTypeId[src]

pub fn is_numeric(&self) -> bool[src]

Tests and returns true if the variant holds a numeric type

pub fn is_array(&self) -> bool[src]

Test if the variant holds an array

pub fn is_array_of_type(&self, variant_type: VariantTypeId) -> bool[src]

pub fn is_valid(&self) -> bool[src]

Tests that the variant is in a valid state. In particular for arrays ensuring that the values are all acceptable and for a multi dimensional array that the dimensions equal the actual values.

pub fn as_f64(&self) -> Option<f64>[src]

Converts the numeric type to a double or returns None

pub fn array_data_type(&self) -> Option<NodeId>[src]

pub fn scalar_data_type(&self) -> Option<NodeId>[src]

pub fn to_byte_array(&self) -> Variant[src]

This function is for a special edge case of converting a byte string to a single array of bytes

pub fn eq_scalar_type(&self, other: &Variant) -> bool[src]

pub fn eq_array_type(&self, other: &Variant) -> bool[src]

pub fn set_range_of(
    &mut self,
    range: NumericRange,
    other: &Variant
) -> Result<(), StatusCode>
[src]

pub fn range_of(&self, range: NumericRange) -> Result<Variant, StatusCode>[src]

This function gets a range of values from the variant if it is an array, or returns a clone of the variant itself.

Trait Implementations

impl BinaryEncoder<Variant> for Variant[src]

impl Clone for Variant[src]

impl Debug for Variant[src]

impl Default for Variant[src]

impl<'de> Deserialize<'de> for Variant[src]

impl Display for Variant[src]

This implementation is mainly for debugging / convenience purposes, to eliminate some of the noise in common types from using the Debug trait.

impl<'a, 'b> From<&'a [&'b str]> for Variant[src]

impl<'a> From<&'a [String]> for Variant[src]

impl<'a> From<&'a [bool]> for Variant[src]

impl<'a> From<&'a [f32]> for Variant[src]

impl<'a> From<&'a [f64]> for Variant[src]

impl<'a> From<&'a [i16]> for Variant[src]

impl<'a> From<&'a [i32]> for Variant[src]

impl<'a> From<&'a [i8]> for Variant[src]

impl<'a> From<&'a [u16]> for Variant[src]

impl<'a> From<&'a [u32]> for Variant[src]

impl<'a> From<&'a [u8]> for Variant[src]

impl<'a> From<&'a Vec<String>> for Variant[src]

impl<'a> From<&'a Vec<bool>> for Variant[src]

impl<'a> From<&'a Vec<f32>> for Variant[src]

impl<'a> From<&'a Vec<f64>> for Variant[src]

impl<'a> From<&'a Vec<i16>> for Variant[src]

impl<'a> From<&'a Vec<i32>> for Variant[src]

impl<'a> From<&'a Vec<i8>> for Variant[src]

impl<'a> From<&'a Vec<u16>> for Variant[src]

impl<'a> From<&'a Vec<u32>> for Variant[src]

impl<'a> From<&'a Vec<u8>> for Variant[src]

impl<'a> From<&'a str> for Variant[src]

impl From<()> for Variant[src]

impl From<(Vec<Variant>, Vec<u32>)> for Variant[src]

impl From<Array> for Variant[src]

impl From<ByteString> for Variant[src]

impl From<DateTime> for Variant[src]

impl From<ExpandedNodeId> for Variant[src]

impl From<ExtensionObject> for Variant[src]

impl From<Guid> for Variant[src]

impl From<LocalizedText> for Variant[src]

impl From<NodeId> for Variant[src]

impl From<QualifiedName> for Variant[src]

impl From<StatusCode> for Variant[src]

impl From<String> for Variant[src]

impl From<UAString> for Variant[src]

impl From<Variant> for LiteralOperand[src]

impl From<Variant> for DataValue[src]

impl From<Vec<String>> for Variant[src]

impl From<Vec<Variant>> for Variant[src]

impl From<Vec<bool>> for Variant[src]

impl From<Vec<f32>> for Variant[src]

impl From<Vec<f64>> for Variant[src]

impl From<Vec<i16>> for Variant[src]

impl From<Vec<i32>> for Variant[src]

impl From<Vec<i8>> for Variant[src]

impl From<Vec<u16>> for Variant[src]

impl From<Vec<u32>> for Variant[src]

impl From<Vec<u8>> for Variant[src]

impl From<bool> for Variant[src]

impl From<f32> for Variant[src]

impl From<f64> for Variant[src]

impl From<i16> for Variant[src]

impl From<i32> for Variant[src]

impl From<i64> for Variant[src]

impl From<i8> for Variant[src]

impl From<u16> for Variant[src]

impl From<u32> for Variant[src]

impl From<u64> for Variant[src]

impl From<u8> for Variant[src]

impl PartialEq<Variant> for Variant[src]

impl Serialize for Variant[src]

impl StructuralPartialEq for Variant[src]

Auto Trait Implementations

impl RefUnwindSafe for Variant

impl Send for Variant

impl Sync for Variant

impl Unpin for Variant

impl UnwindSafe for Variant

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,