Enum netidx_netproto::value::Value
source · pub enum Value {
}
Variants§
U32(u32)
full 4 byte u32
V32(u32)
LEB128 varint, 1 - 5 bytes depending on value
I32(i32)
full 4 byte i32
Z32(i32)
LEB128 varint zigzag encoded, 1 - 5 bytes depending on abs(value)
U64(u64)
full 8 byte u64
V64(u64)
LEB128 varint, 1 - 10 bytes depending on value
I64(i64)
full 8 byte i64
Z64(i64)
LEB128 varint zigzag encoded, 1 - 10 bytes depending on abs(value)
F32(f32)
4 byte ieee754 single precision float
F64(f64)
8 byte ieee754 double precision float
DateTime(DateTime<Utc>)
UTC timestamp
Duration(Duration)
Duration
String(Chars)
unicode string, zero copy decode
Bytes(Bytes)
byte array, zero copy decode
True
boolean true
False
boolean false
Null
Empty value
Ok
An explicit ok
Error(Chars)
An explicit error
Array(Arc<[Value]>)
An array of values
Decimal(Decimal)
fixed point decimal type
Implementations§
source§impl Value
impl Value
pub fn to_string_naked(&self) -> String
pub fn fmt_naked(&self, f: &mut Formatter<'_>) -> Result
pub fn fmt_notyp(&self, f: &mut Formatter<'_>) -> Result
pub fn fmt_ext( &self, f: &mut Formatter<'_>, esc: &[char], types: bool ) -> Result
sourcepub fn cast(self, typ: Typ) -> Option<Value>
pub fn cast(self, typ: Typ) -> Option<Value>
Whatever value is attempt to turn it into the type specified
sourcepub fn cast_to<T: FromValue + Sized>(self) -> Res<T>
pub fn cast_to<T: FromValue + Sized>(self) -> Res<T>
cast value directly to any type implementing FromValue
pub fn get_as<T: FromValue + Sized>(self) -> Option<T>
pub fn err<T: Error>(e: T) -> Value
Trait Implementations§
source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<K: Into<Value>, V: Into<Value>, S: BuildHasher + Default> From<HashMap<K, V, S>> for Value
impl<K: Into<Value>, V: Into<Value>, S: BuildHasher + Default> From<HashMap<K, V, S>> for Value
source§impl<K: Into<Value>, V: Into<Value>, S: BuildHasher + Default> From<IndexMap<K, V, S>> for Value
impl<K: Into<Value>, V: Into<Value>, S: BuildHasher + Default> From<IndexMap<K, V, S>> for Value
source§impl Ord for Value
impl Ord for Value
source§impl Pack for Value
impl Pack for Value
fn encoded_len(&self) -> usize
fn encode(&self, buf: &mut impl BufMut) -> Result<(), PackError>
fn decode(buf: &mut impl Buf) -> Result<Self, PackError>
fn const_encoded_len() -> Option<usize>
fn decode_into(&mut self, buf: &mut impl Buf) -> Result<(), PackError>where
Self: Sized,
source§impl PartialOrd for Value
impl PartialOrd for Value
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Value
Auto Trait Implementations§
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a [
CompactString
]. Read more