Enum ValueRef

Source
pub enum ValueRef<'a> {
Show 19 variants Null, Bool(bool), Int(Integer), Str(&'a str), F32(f32), F64(f64), Bin(&'a [u8]), Array(Vec<ValueRef<'a>>), Map(BTreeMap<&'a str, ValueRef<'a>>), Hash(Hash), Identity(Identity), StreamId(StreamId), LockId(LockId), Timestamp(Timestamp), DataLockbox(&'a DataLockboxRef), IdentityLockbox(&'a IdentityLockboxRef), StreamLockbox(&'a StreamLockboxRef), LockLockbox(&'a LockLockboxRef), BareIdKey(Box<BareIdKey>),
}
Expand description

A single fog-pack value, built using references to underlying data as much as possible.

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

Variants§

§

Null

§

Bool(bool)

§

Int(Integer)

§

Str(&'a str)

§

F32(f32)

§

F64(f64)

§

Bin(&'a [u8])

§

Array(Vec<ValueRef<'a>>)

§

Map(BTreeMap<&'a str, ValueRef<'a>>)

§

Hash(Hash)

§

Identity(Identity)

§

StreamId(StreamId)

§

LockId(LockId)

§

Timestamp(Timestamp)

§

DataLockbox(&'a DataLockboxRef)

§

IdentityLockbox(&'a IdentityLockboxRef)

§

StreamLockbox(&'a StreamLockboxRef)

§

LockLockbox(&'a LockLockboxRef)

§

BareIdKey(Box<BareIdKey>)

Implementations§

Source§

impl<'a> ValueRef<'a>

Source

pub fn to_owned(&self) -> Value

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_bin(&self) -> Option<&[u8]>

Source

pub fn as_array(&self) -> Option<&[ValueRef<'a>]>

Source

pub fn as_array_mut(&mut self) -> Option<&mut [ValueRef<'a>]>

Source

pub fn as_map(&self) -> Option<&BTreeMap<&'a str, ValueRef<'a>>>

Source

pub fn as_map_mut(&mut self) -> Option<&mut BTreeMap<&'a str, ValueRef<'a>>>

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<'a> Clone for ValueRef<'a>

Source§

fn clone(&self) -> ValueRef<'a>

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<'a> Debug for ValueRef<'a>

Source§

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

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

impl<'a> Default for ValueRef<'a>

Source§

fn default() -> ValueRef<'a>

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

impl<'de> Deserialize<'de> for ValueRef<'de>

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 ValueRef<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<&'a DataLockboxRef> for ValueRef<'a>

Source§

fn from(v: &'a DataLockboxRef) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a IdentityLockboxRef> for ValueRef<'a>

Source§

fn from(v: &'a IdentityLockboxRef) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a LockLockboxRef> for ValueRef<'a>

Source§

fn from(v: &'a LockLockboxRef) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a StreamLockboxRef> for ValueRef<'a>

Source§

fn from(v: &'a StreamLockboxRef) -> Self

Converts to this type from the input type.
Source§

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

Source§

fn from(v: &'a str) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<()> for ValueRef<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<BTreeMap<&'a str, ValueRef<'a>>> for ValueRef<'a>

Source§

fn from(v: BTreeMap<&'a str, ValueRef<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<BareIdKey> for ValueRef<'a>

Source§

fn from(value: BareIdKey) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Hash> for ValueRef<'a>

Source§

fn from(v: Hash) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Identity> for ValueRef<'a>

Source§

fn from(v: Identity) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Integer> for ValueRef<'a>

Source§

fn from(v: Integer) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<LockId> for ValueRef<'a>

Source§

fn from(v: LockId) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<StreamId> for ValueRef<'a>

Source§

fn from(v: StreamId) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Timestamp> for ValueRef<'a>

Source§

fn from(v: Timestamp) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Vec<ValueRef<'a>>> for ValueRef<'a>

Source§

fn from(v: Vec<ValueRef<'a>>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<bool> for ValueRef<'a>

Source§

fn from(v: bool) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<f32> for ValueRef<'a>

Source§

fn from(v: f32) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<f64> for ValueRef<'a>

Source§

fn from(v: f64) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<i16> for ValueRef<'a>

Source§

fn from(v: i16) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<i32> for ValueRef<'a>

Source§

fn from(v: i32) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<i64> for ValueRef<'a>

Source§

fn from(v: i64) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<i8> for ValueRef<'a>

Source§

fn from(v: i8) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<isize> for ValueRef<'a>

Source§

fn from(v: isize) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<u16> for ValueRef<'a>

Source§

fn from(v: u16) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<u32> for ValueRef<'a>

Source§

fn from(v: u32) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<u64> for ValueRef<'a>

Source§

fn from(v: u64) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<u8> for ValueRef<'a>

Source§

fn from(v: u8) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<usize> for ValueRef<'a>

Source§

fn from(v: usize) -> Self

Converts to this type from the input type.
Source§

impl<'a, V: Into<ValueRef<'a>>> FromIterator<V> for ValueRef<'a>

Source§

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

Creates a value from an iterator. Read more
Source§

impl<'a> Index<&str> for ValueRef<'a>

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

Source§

type Output = ValueRef<'a>

The returned type after indexing.
Source§

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

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

impl<'a> Index<usize> for ValueRef<'a>

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

Source§

type Output = ValueRef<'a>

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<'a> PartialEq for ValueRef<'a>

Source§

fn eq(&self, other: &ValueRef<'a>) -> 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> Serialize for ValueRef<'a>

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<'a> TryFrom<ValueRef<'a>> for &'a [u8]

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for &'a DataLockboxRef

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for &'a IdentityLockboxRef

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for &'a LockLockboxRef

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for &'a StreamLockboxRef

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for &'a str

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for BTreeMap<&'a str, ValueRef<'a>>

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for BareIdKey

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for Hash

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for Identity

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for LockId

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for StreamId

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for Timestamp

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for Vec<ValueRef<'a>>

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for bool

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for f32

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for f64

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for i16

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for i32

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for i64

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for i8

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for isize

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for u16

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for u32

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for u64

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for u8

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for usize

Source§

type Error = ValueRef<'a>

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

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> StructuralPartialEq for ValueRef<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ValueRef<'a>

§

impl<'a> RefUnwindSafe for ValueRef<'a>

§

impl<'a> Send for ValueRef<'a>

§

impl<'a> Sync for ValueRef<'a>

§

impl<'a> Unpin for ValueRef<'a>

§

impl<'a> UnwindSafe for ValueRef<'a>

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.