Enum opcua_server::prelude::Variant [−][src]
pub enum Variant {
Show 24 variants
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, Global>),
Guid(Box<Guid, Global>),
StatusCode(StatusCode),
ByteString(ByteString),
XmlElement(UAString),
QualifiedName(Box<QualifiedName, Global>),
LocalizedText(Box<LocalizedText, Global>),
NodeId(Box<NodeId, Global>),
ExpandedNodeId(Box<ExpandedNodeId, Global>),
ExtensionObject(Box<ExtensionObject, Global>),
Array(Box<Array, Global>),
}Expand description
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 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
Guid
StatusCode(StatusCode)StatusCode
ByteString(ByteString)ByteString
XmlElement(UAString)XmlElement
QualifiedName(Box<QualifiedName, Global>)QualifiedName
LocalizedText(Box<LocalizedText, Global>)LocalizedText
NodeId
ExpandedNodeId(Box<ExpandedNodeId, Global>)ExpandedNodeId
ExtensionObject(Box<ExtensionObject, Global>)ExtensionObject
Single dimension array which can contain any scalar type, all the same type. Nested arrays will be rejected.
Implementations
Test the flag (convenience method)
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.
Performs an IMPLICIT conversion from one type to another
Tests and returns true if the variant holds a numeric type
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.
This function is for a special edge case of converting a byte string to a single array of bytes
pub fn set_range_of(
&mut self,
range: NumericRange,
other: &Variant
) -> Result<(), StatusCode>
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
Returns the exact byte length of the structure as it would be if encode were called.
This may be called prior to writing to ensure the correct amount of space is available. Read more
Encodes the instance to the write stream.
pub fn decode<S>(
stream: &mut S,
decoding_limits: &DecodingLimits
) -> Result<Variant, StatusCode> where
S: Read,
pub fn decode<S>(
stream: &mut S,
decoding_limits: &DecodingLimits
) -> Result<Variant, StatusCode> where
S: Read,
Decodes an instance from the read stream. The decoding limits are restrictions set by the server / client
on the length of strings, arrays etc. If these limits are exceeded the implementation should
return with a BadDecodingError as soon as possible. Read more
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Variant, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Variant, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This implementation is mainly for debugging / convenience purposes, to eliminate some of the noise in common types from using the Debug trait.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Variant
impl UnwindSafe for Variant
Blanket Implementations
Mutably borrows from an owned value. Read more