pub enum PropertyValue {
Show 21 variants
Empty,
Boolean(bool),
UChar(u8),
Short(i16),
UShort(u16),
Long(i32),
ULong(u32),
Long64(i64),
ULong64(u64),
Float(f32),
Double(f64),
String(Vec<u8>),
ShortArray(Vec<i16>),
UShortArray(Vec<u16>),
LongArray(Vec<i32>),
ULongArray(Vec<u32>),
Long64Array(Vec<i64>),
ULong64Array(Vec<u64>),
FloatArray(Vec<f32>),
DoubleArray(Vec<f64>),
StringArray(Vec<Vec<u8>>),
}Expand description
Represents the value of a property.
The normal way to construct this is to use the desired variant directly.
Variants§
Empty
Boolean(bool)
UChar(u8)
Short(i16)
UShort(u16)
Long(i32)
ULong(u32)
Long64(i64)
ULong64(u64)
Float(f32)
Double(f64)
String(Vec<u8>)
ShortArray(Vec<i16>)
UShortArray(Vec<u16>)
LongArray(Vec<i32>)
ULongArray(Vec<u32>)
Long64Array(Vec<i64>)
ULong64Array(Vec<u64>)
FloatArray(Vec<f32>)
DoubleArray(Vec<f64>)
StringArray(Vec<Vec<u8>>)
Implementations§
Source§impl PropertyValue
impl PropertyValue
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return the number of data items in this value.
0 for Empty, 1 for simple data, length of the array for array data.
Sourcepub fn convert(self, to: TangoDataType) -> Result<Self, Self>
pub fn convert(self, to: TangoDataType) -> Result<Self, Self>
Try to convert this data into a different type.
If the conversion fails or is impossible, Self is returned unchanged
in the Err variant.
Sourcepub fn into_bool(self) -> Result<bool, Self>
pub fn into_bool(self) -> Result<bool, Self>
Return the value if it’s a bool or integral 0 or 1. Otherwise return
Err(self).
Sourcepub fn into_i32(self) -> Result<i32, Self>
pub fn into_i32(self) -> Result<i32, Self>
Return the value as i32 if it’s an integral type and inside i32 limits.
Otherwise return Err(self).
Sourcepub fn into_i64(self) -> Result<i64, Self>
pub fn into_i64(self) -> Result<i64, Self>
Return the value as i64 if it’s a an integral type and inside i64
limits. Otherwise return Err(self).
Sourcepub fn into_u32(self) -> Result<u32, Self>
pub fn into_u32(self) -> Result<u32, Self>
Return the value as u32 if it’s an integral type and inside u32 limits.
Otherwise return Err(self).
Sourcepub fn into_u64(self) -> Result<u64, Self>
pub fn into_u64(self) -> Result<u64, Self>
Return the value as u64 if it’s an integral type and inside u64 limits.
Otherwise return Err(self).
Sourcepub fn into_f32(self) -> Result<f32, Self>
pub fn into_f32(self) -> Result<f32, Self>
Return the value as f32 if it’s a numeric type. Otherwise return Err(self).
Sourcepub fn into_f64(self) -> Result<f64, Self>
pub fn into_f64(self) -> Result<f64, Self>
Return the value as f64 if it’s a numeric type. Otherwise return Err(self).
Sourcepub fn into_bytes(self) -> Result<Vec<u8>, Self>
pub fn into_bytes(self) -> Result<Vec<u8>, Self>
Return the value as a byte array if it’s a string. Otherwise return
Err(self).
Sourcepub fn into_string(self) -> Result<String, Self>
pub fn into_string(self) -> Result<String, Self>
Return the value as a string if it’s a string and decodable as UTF-8.
Otherwise return Err(self).
Trait Implementations§
Source§impl Clone for PropertyValue
impl Clone for PropertyValue
Source§fn clone(&self) -> PropertyValue
fn clone(&self) -> PropertyValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PropertyValue
impl Debug for PropertyValue
Source§impl<'de> Deserialize<'de> for PropertyValue
impl<'de> Deserialize<'de> for PropertyValue
Source§fn deserialize<D: Deserializer<'de>>(
deser: D,
) -> Result<PropertyValue, D::Error>
fn deserialize<D: Deserializer<'de>>( deser: D, ) -> Result<PropertyValue, D::Error>
Source§impl Display for PropertyValue
impl Display for PropertyValue
Source§impl LowerExp for PropertyValue
impl LowerExp for PropertyValue
Source§impl LowerHex for PropertyValue
impl LowerHex for PropertyValue
Source§impl PartialEq for PropertyValue
impl PartialEq for PropertyValue
Source§fn eq(&self, other: &PropertyValue) -> bool
fn eq(&self, other: &PropertyValue) -> bool
self and other values to be equal, and is used by ==.