[−][src]Enum b3_rs::ItemValue
The value of an item.
Variants
A null value.
A list containing multiple Item
s.
A list containing multiple Item
s, where the presence of an ItemKey
on the objects contained within is guaranteed.
A byte array.
UTF8(String)
A UTF-8 string.
Boolean(bool)
A boolean.
Int64(i64)
A signed 64-bit integer.
UVarInt(u64)
An unsigned variable-length integer, represented as a u64
.
SVarInt(i64)
A signed variable-length integer, represented as an i64
.
Float64(f64)
A 64-bit floating point number.
Stamp64(i64)
A signed UNIX timestamp, represented as an i64
.
Arbitrary data of an unknown type.
This type's first value is the type number sent on the wire, and the second value is a byte array of the raw data sent in the message.
Implementations
impl ItemValue
[src]
pub fn data_type(&self) -> DataType
[src]
Returns the DataType of this value.
pub fn encode(&self) -> Result<(DataType, Vec<u8>), Error>
[src]
Encodes this value into it's byte representation.
If encoding was successful, returns the data type of the encoded
value, and a Vec<u8>
of the bytes representing the value.
pub fn decode(header: &ItemHeader, data: &[u8]) -> Result<(Self, usize), Error>
[src]
Decode the given data using the type and data length from the given
ItemHeader
.
If decoding succeeds, returns the decoded ItemValue
, and the number
of bytes consumed by this decode operation.
pub fn get_entries(&self) -> Option<Vec<Item>>
[src]
Return the entries contained in this ItemValue
, if this value is a
CompositeList
or a CompositeDict
.
pub fn get_bytes(&self) -> Option<Vec<u8>>
[src]
Get the bytes conatined in this ItemValue
, if this value is a
Bytes
.
pub fn get_utf8(&self) -> Option<String>
[src]
Get the UTF-8 string contained in this ItemValue
, if this value is
a UTF8
.
pub fn get_bool(&self) -> Option<bool>
[src]
Get the boolean contained in this ItemValue
, if this value is a
Boolean
.
pub fn get_i64(&self) -> Option<i64>
[src]
Get the i64
contained in this ItemValue
, if this value is a
Int64
, a SVarInt
, or a Stamp64
.
pub fn get_u64(&self) -> Option<u64>
[src]
Get the u64
contained in this ItemValue
, if this value is a
UVarInt
.
pub fn get_f64(&self) -> Option<f64>
[src]
Get the f64
contained in this ItemValue
, if this value is a
Float64
.
Trait Implementations
impl Clone for ItemValue
[src]
impl Debug for ItemValue
[src]
impl PartialEq<ItemValue> for ItemValue
[src]
impl StructuralPartialEq for ItemValue
[src]
Auto Trait Implementations
impl RefUnwindSafe for ItemValue
impl Send for ItemValue
impl Sync for ItemValue
impl Unpin for ItemValue
impl UnwindSafe for ItemValue
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> 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, 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>,