Value

Enum Value 

Source
pub enum Value {
Show 19 variants Null, Bool(bool), Int(Integer), Str(String), F32(f32), F64(f64), Bin(Vec<u8>), Array(Vec<Value>), Map(BTreeMap<String, Value>), Timestamp(Timestamp), Hash(Hash), Identity(Identity), LockId(LockId), StreamId(StreamId), DataLockbox(DataLockbox), IdentityLockbox(IdentityLockbox), StreamLockbox(StreamLockbox), LockLockbox(LockLockbox), BareIdKey(Box<BareIdKey>),
}
Expand description

A single, self-contained fog-pack value.

This enum covers all value types that fog-pack specifically encodes.

Variants§

§

Null

§

Bool(bool)

§

Int(Integer)

§

Str(String)

§

F32(f32)

§

F64(f64)

§

Bin(Vec<u8>)

§

Array(Vec<Value>)

§

Map(BTreeMap<String, Value>)

§

Timestamp(Timestamp)

§

Hash(Hash)

§

Identity(Identity)

§

LockId(LockId)

§

StreamId(StreamId)

§

DataLockbox(DataLockbox)

§

IdentityLockbox(IdentityLockbox)

§

StreamLockbox(StreamLockbox)

§

LockLockbox(LockLockbox)

§

BareIdKey(Box<BareIdKey>)

Implementations§

Source§

impl Value

Source

pub fn as_ref(&self) -> ValueRef<'_>

Transform the value into a ValueRef.

Source

pub fn is_null(&self) -> bool

Source

pub fn is_bool(&self) -> bool

Source

pub fn is_int(&self) -> bool

Source

pub fn is_i64(&self) -> bool

Source

pub fn is_u64(&self) -> bool

Source

pub fn is_f32(&self) -> bool

Source

pub fn is_f64(&self) -> bool

Source

pub fn is_str(&self) -> bool

Source

pub fn is_bin(&self) -> bool

Source

pub fn is_array(&self) -> bool

Source

pub fn is_map(&self) -> bool

Source

pub fn is_timestamp(&self) -> bool

Source

pub fn is_hash(&self) -> bool

Source

pub fn is_identity(&self) -> bool

Source

pub fn is_stream_id(&self) -> bool

Source

pub fn is_lock_id(&self) -> bool

Source

pub fn is_lockbox(&self) -> bool

Source

pub fn is_data_lockbox(&self) -> bool

Source

pub fn is_identity_lockbox(&self) -> bool

Source

pub fn is_stream_lockbox(&self) -> bool

Source

pub fn is_lock_lockbox(&self) -> bool

Source

pub fn is_bare_id_key(&self) -> bool

Source

pub fn as_bool(&self) -> Option<bool>

Source

pub fn as_int(&self) -> Option<Integer>

Source

pub fn as_i64(&self) -> Option<i64>

Source

pub fn as_u64(&self) -> Option<u64>

Source

pub fn as_f32(&self) -> Option<f32>

Source

pub fn as_f64(&self) -> Option<f64>

Source

pub fn as_floating(&self) -> Option<f64>

Source

pub fn as_str(&self) -> Option<&str>

Source

pub fn as_string(&self) -> Option<&String>

Source

pub fn as_slice(&self) -> Option<&[u8]>

Source

pub fn as_array(&self) -> Option<&[Value]>

Source

pub fn as_array_mut(&mut self) -> Option<&mut [Value]>

Source

pub fn as_map(&self) -> Option<&BTreeMap<String, Value>>

Source

pub fn as_map_mut(&mut self) -> Option<&mut BTreeMap<String, Value>>

Source

pub fn as_timestamp(&self) -> Option<Timestamp>

Source

pub fn as_hash(&self) -> Option<&Hash>

Source

pub fn as_identity(&self) -> Option<&Identity>

Source

pub fn as_stream_id(&self) -> Option<&StreamId>

Source

pub fn as_lock_id(&self) -> Option<&LockId>

Source

pub fn as_data_lockbox(&self) -> Option<&DataLockboxRef>

Source

pub fn as_identity_lockbox(&self) -> Option<&IdentityLockboxRef>

Source

pub fn as_stream_lockbox(&self) -> Option<&StreamLockboxRef>

Source

pub fn as_lock_lockbox(&self) -> Option<&LockLockboxRef>

Source

pub fn as_bare_id_key(&self) -> Option<&BareIdKey>

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Value

Source§

fn default() -> Value

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a> From<&'a [u8]> for Value

Source§

fn from(v: &[u8]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for Value

Source§

fn from(v: &str) -> Self

Converts to this type from the input type.
Source§

impl From<()> for Value

Source§

fn from((): ()) -> Self

Converts to this type from the input type.
Source§

impl From<BTreeMap<String, Value>> for Value

Source§

fn from(v: BTreeMap<String, Value>) -> Self

Converts to this type from the input type.
Source§

impl From<BareIdKey> for Value

Source§

fn from(value: BareIdKey) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Cow<'a, [u8]>> for Value

Source§

fn from(v: Cow<'a, [u8]>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Cow<'a, str>> for Value

Source§

fn from(v: Cow<'a, str>) -> Self

Converts to this type from the input type.
Source§

impl From<DataLockbox> for Value

Source§

fn from(v: DataLockbox) -> Self

Converts to this type from the input type.
Source§

impl From<Hash> for Value

Source§

fn from(v: Hash) -> Self

Converts to this type from the input type.
Source§

impl From<Identity> for Value

Source§

fn from(v: Identity) -> Self

Converts to this type from the input type.
Source§

impl From<IdentityLockbox> for Value

Source§

fn from(v: IdentityLockbox) -> Self

Converts to this type from the input type.
Source§

impl From<Integer> for Value

Source§

fn from(v: Integer) -> Self

Converts to this type from the input type.
Source§

impl From<LockId> for Value

Source§

fn from(v: LockId) -> Self

Converts to this type from the input type.
Source§

impl From<LockLockbox> for Value

Source§

fn from(v: LockLockbox) -> Self

Converts to this type from the input type.
Source§

impl From<StreamId> for Value

Source§

fn from(v: StreamId) -> Self

Converts to this type from the input type.
Source§

impl From<StreamLockbox> for Value

Source§

fn from(v: StreamLockbox) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(v: String) -> Self

Converts to this type from the input type.
Source§

impl From<Timestamp> for Value

Source§

fn from(v: Timestamp) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Value>> for Value

Source§

fn from(v: Vec<Value>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Value

Source§

fn from(v: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(v: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Value

Source§

fn from(v: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Value

Source§

fn from(v: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Value

Source§

fn from(v: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Value

Source§

fn from(v: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(v: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Value

Source§

fn from(v: i8) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for Value

Source§

fn from(v: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Value

Source§

fn from(v: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Value

Source§

fn from(v: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(v: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Value

Source§

fn from(v: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Value

Source§

fn from(v: usize) -> Self

Converts to this type from the input type.
Source§

impl<V: Into<Value>> FromIterator<V> for Value

Source§

fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl Index<&str> for Value

Support indexing into maps. If the index string is not in the map, this returns a Value::Null.

Source§

type Output = Value

The returned type after indexing.
Source§

fn index(&self, index: &str) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for Value

Support indexing into arrays. If the index is out of range or the value isn’t an array, this returns a Value::Null.

Source§

type Output = Value

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a> PartialEq<Value> for ValueRef<'a>

Source§

fn eq(&self, other: &Value) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<ValueRef<'a>> for Value

Source§

fn eq(&self, other: &ValueRef<'_>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Value

Source§

fn eq(&self, other: &Value) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Value

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<Value> for BTreeMap<String, Value>

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for BareIdKey

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for DataLockbox

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for Hash

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for Identity

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for IdentityLockbox

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for LockId

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for LockLockbox

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for StreamId

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for StreamLockbox

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for String

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for Timestamp

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for Vec<Value>

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for Vec<u8>

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for bool

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for f32

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for f64

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for i16

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for i32

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for i64

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for i8

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for isize

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for u16

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for u32

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for u64

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for u8

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for usize

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,