pub enum Value {
Show 21 variants U32(u32), V32(u32), I32(i32), Z32(i32), U64(u64), V64(u64), I64(i64), Z64(i64), F32(f32), F64(f64), DateTime(DateTime<Utc>), Duration(Duration), String(Chars), Bytes(Bytes), True, False, Null, Ok, Error(Chars), Array(Arc<[Value]>), Decimal(Decimal),
}

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

source

pub fn to_string_naked(&self) -> String

source

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

source

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

source

pub fn fmt_ext( &self, f: &mut Formatter<'_>, esc: &[char], types: bool ) -> Result

source

pub fn cast(self, typ: Typ) -> Option<Value>

Whatever value is attempt to turn it into the type specified

source

pub fn cast_to<T: FromValue + Sized>(self) -> Res<T>

cast value directly to any type implementing FromValue

source

pub fn get_as<T: FromValue + Sized>(self) -> Option<T>

source

pub fn err<T: Error>(e: T) -> Value

source

pub fn number(&self) -> bool

return true if the value is some kind of number, otherwise false.

source

pub fn flatten(self) -> impl Iterator<Item = Value>

return an iterator that will perform a depth first traversal of the specified value. All array elements will be flattened into non array values.

Trait Implementations§

source§

impl Add for Value

§

type Output = Value

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
source§

impl Clone for Value

source§

fn clone(&self) -> Value

Returns a copy 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<'de> Deserialize<'de> for Value

source§

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 Display for Value

source§

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

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

impl Div for Value

§

type Output = Value

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
source§

impl<T: Into<Value> + Copy> From<&T> for Value

source§

fn from(v: &T) -> Value

Converts to this type from the input type.
source§

impl From<&'static str> for Value

source§

fn from(v: &'static str) -> Value

Converts to this type from the input type.
source§

impl<T: Into<Value>, U: Into<Value>> From<(T, U)> for Value

source§

fn from((t, u): (T, U)) -> Value

Converts to this type from the input type.
source§

impl<T: Into<Value>, U: Into<Value>, V: Into<Value>> From<(T, U, V)> for Value

source§

fn from((t, u, v): (T, U, V)) -> Value

Converts to this type from the input type.
source§

impl From<Arc<[Value]>> for Value

source§

fn from(v: Arc<[Value]>) -> Value

Converts to this type from the input type.
source§

impl From<ArcStr> for Value

source§

fn from(v: ArcStr) -> Value

Converts to this type from the input type.
source§

impl<K: Into<Value>, V: Into<Value>> From<BTreeMap<K, V>> for Value

source§

fn from(v: BTreeMap<K, V>) -> Self

Converts to this type from the input type.
source§

impl<K: Into<Value>> From<BTreeSet<K>> for Value

source§

fn from(s: BTreeSet<K>) -> Self

Converts to this type from the input type.
source§

impl<T> From<BitFlags<T>> for Value
where T: BitFlag, <T as RawBitFlags>::Numeric: Into<Value>,

source§

fn from(v: BitFlags<T>) -> Self

Converts to this type from the input type.
source§

impl From<Bytes> for Value

source§

fn from(v: Bytes) -> Value

Converts to this type from the input type.
source§

impl From<Chars> for Value

source§

fn from(v: Chars) -> Value

Converts to this type from the input type.
source§

impl From<DateTime<Utc>> for Value

source§

fn from(v: DateTime<Utc>) -> Value

Converts to this type from the input type.
source§

impl From<Decimal> for Value

source§

fn from(value: Decimal) -> Self

Converts to this type from the input type.
source§

impl From<Duration> for Value

source§

fn from(v: Duration) -> Value

Converts to this type from the input type.
source§

impl<K: Into<Value>, V: Into<Value>, S: BuildHasher + Default> From<HashMap<K, V, S>> for Value

source§

fn from(h: HashMap<K, V, S>) -> Value

Converts to this type from the input type.
source§

impl<K: Into<Value>, S: BuildHasher + Default> From<HashSet<K, S>> for Value

source§

fn from(h: HashSet<K, S>) -> Value

Converts to this type from the input type.
source§

impl<K: Into<Value>, V: Into<Value>, S: BuildHasher + Default> From<IndexMap<K, V, S>> for Value

source§

fn from(h: IndexMap<K, V, S>) -> Value

Converts to this type from the input type.
source§

impl<K: Into<Value>, S: BuildHasher + Default> From<IndexSet<K, S>> for Value

source§

fn from(h: IndexSet<K, S>) -> Value

Converts to this type from the input type.
source§

impl<T: Into<Value>> From<Option<T>> for Value

source§

fn from(o: Option<T>) -> Value

Converts to this type from the input type.
source§

impl From<Path> for Value

source§

fn from(v: Path) -> Value

Converts to this type from the input type.
source§

impl<T: Into<Value> + Clone + Send + Sync> From<Pooled<Vec<T>>> for Value

source§

fn from(v: Pooled<Vec<T>>) -> Value

Converts to this type from the input type.
source§

impl<A> From<SmallVec<A>> for Value
where A: Array, <A as Array>::Item: Into<Value>,

source§

fn from(v: SmallVec<A>) -> Self

Converts to this type from the input type.
source§

impl From<String> for Value

source§

fn from(v: String) -> Value

Converts to this type from the input type.
source§

impl From<Uuid> for Value

source§

fn from(id: Uuid) -> Self

Converts to this type from the input type.
source§

impl<T: Into<Value>> From<Vec<T>> for Value

source§

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

Converts to this type from the input type.
source§

impl From<bool> for Value

source§

fn from(v: bool) -> Value

Converts to this type from the input type.
source§

impl From<f32> for Value

source§

fn from(v: f32) -> Value

Converts to this type from the input type.
source§

impl From<f64> for Value

source§

fn from(v: f64) -> Value

Converts to this type from the input type.
source§

impl From<i16> for Value

source§

fn from(v: i16) -> Value

Converts to this type from the input type.
source§

impl From<i32> for Value

source§

fn from(v: i32) -> Value

Converts to this type from the input type.
source§

impl From<i64> for Value

source§

fn from(v: i64) -> Value

Converts to this type from the input type.
source§

impl From<i8> for Value

source§

fn from(v: i8) -> Value

Converts to this type from the input type.
source§

impl From<u16> for Value

source§

fn from(v: u16) -> Value

Converts to this type from the input type.
source§

impl From<u32> for Value

source§

fn from(v: u32) -> Value

Converts to this type from the input type.
source§

impl From<u64> for Value

source§

fn from(v: u64) -> Value

Converts to this type from the input type.
source§

impl From<u8> for Value

source§

fn from(v: u8) -> Value

Converts to this type from the input type.
source§

impl From<usize> for Value

source§

fn from(v: usize) -> Value

Converts to this type from the input type.
source§

impl FromStr for Value

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl FromValue for Value

source§

fn from_value(v: Value) -> Res<Self>

attempt to cast v to the type of self using any reasonable means
source§

fn get(v: Value) -> Option<Self>

extract the type of self from v if the type of v is equivelent to the type of self, otherwise return None.
source§

impl Hash for Value

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Mul for Value

§

type Output = Value

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
source§

impl Not for Value

§

type Output = Value

The resulting type after applying the ! operator.
source§

fn not(self) -> Self

Performs the unary ! operation. Read more
source§

impl Ord for Value

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl Pack for Value

source§

fn encoded_len(&self) -> usize

source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), PackError>

source§

fn decode(buf: &mut impl Buf) -> Result<Self, PackError>

source§

fn const_encoded_len() -> Option<usize>

source§

fn decode_into(&mut self, buf: &mut impl Buf) -> Result<(), PackError>
where Self: Sized,

source§

impl PartialEq for Value

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Value

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Value

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

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

impl Sub for Value

§

type Output = Value

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
source§

impl 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> 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
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

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
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> ToCompactString for T
where T: Display,

§

fn to_compact_string(&self) -> CompactString

Converts the given value to a [CompactString]. Read more
source§

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

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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>,