pub enum Value {
None,
Bool(bool),
Unsigned(u64),
Signed(i64),
Float(NotNan<f64>),
Tuple(Box<[Value]>),
Str(Box<str>),
Bytes(Box<[u8]>),
Decimal(Decimal),
}Expand description
The general type for holding all kinds of values.
Variants§
None
Expresses the absence of a value.
Bool(bool)
A boolean value.
Unsigned(u64)
An unsigned integer with 64 bits.
Signed(i64)
A signed integer with 64 bits.
Float(NotNan<f64>)
A double-precision floating-point number that is not NaN.
Tuple(Box<[Value]>)
A tuple of Values.
The nested values can be of different type.
Str(Box<str>)
A string that must be utf-8 encoded.
Bytes(Box<[u8]>)
A slice of bytes.
Decimal(Decimal)
A signed fixed-point number
Implementations§
Source§impl Value
impl Value
Sourcepub fn try_from_bytes(
source: &[u8],
ty: &Type,
) -> Result<Value, ValueConvertError>
pub fn try_from_bytes( source: &[u8], ty: &Type, ) -> Result<Value, ValueConvertError>
Returns the interpreted values of an byte representation, if possible:
§Arguments
- ‘source’ - A byte slice that holds the value
- ‘ty’ - the type of the interpretation
Trait Implementations§
Source§impl AddAssign for Value
impl AddAssign for Value
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl DivAssign for Value
impl DivAssign for Value
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/= operation. Read moreSource§impl MulAssign for Value
impl MulAssign for Value
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl Ord for Value
impl Ord for Value
Source§impl PartialOrd for Value
impl PartialOrd for Value
Source§impl RemAssign for Value
impl RemAssign for Value
Source§fn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
Performs the
%= operation. Read moreSource§impl SubAssign for Value
impl SubAssign for Value
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Eq for Value
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more