[−][src]Enum opcua_server::prelude::Variant
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>)QualifiedName
LocalizedText(Box<LocalizedText>)LocalizedText
NodeId
ExpandedNodeId(Box<ExpandedNodeId>)ExpandedNodeId
ExtensionObject(Box<ExtensionObject>)ExtensionObject
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]
&mut self,
range: NumericRange,
other: &Variant
) -> Result<(), StatusCode>
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]
fn byte_len(&self) -> usize[src]
fn encode<S>(&self, stream: &mut S) -> Result<usize, StatusCode> where
S: Write, [src]
S: Write,
fn decode<S>(
stream: &mut S,
decoding_limits: &DecodingLimits
) -> Result<Variant, StatusCode> where
S: Read, [src]
stream: &mut S,
decoding_limits: &DecodingLimits
) -> Result<Variant, StatusCode> where
S: Read,
fn encode_to_vec(&self) -> Vec<u8>[src]
impl Clone for Variant[src]
impl Debug for Variant[src]
impl Default for Variant[src]
impl<'de> Deserialize<'de> for Variant[src]
fn deserialize<__D>(
__deserializer: __D
) -> Result<Variant, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>, [src]
__deserializer: __D
) -> Result<Variant, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
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]
fn from(v: ByteString) -> Variant[src]
impl From<DateTime> for Variant[src]
impl From<ExpandedNodeId> for Variant[src]
fn from(v: ExpandedNodeId) -> Variant[src]
impl From<ExtensionObject> for Variant[src]
fn from(v: ExtensionObject) -> Variant[src]
impl From<Guid> for Variant[src]
impl From<LocalizedText> for Variant[src]
fn from(v: LocalizedText) -> Variant[src]
impl From<NodeId> for Variant[src]
impl From<QualifiedName> for Variant[src]
fn from(v: QualifiedName) -> Variant[src]
impl From<StatusCode> for Variant[src]
fn from(v: StatusCode) -> Variant[src]
impl From<String> for Variant[src]
impl From<UAString> for Variant[src]
impl From<Variant> for LiteralOperand[src]
fn from(v: Variant) -> 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]
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer, [src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,