Enum Value

Source
pub enum Value {
    Bytes(Arc<[u8]>),
    Email(Arc<EmailAddress>),
    Link(Link),
    Id(Id),
    None,
    Number(Number),
    String(TCString),
    Tuple(Tuple<Self>),
    Version(Version),
}
Expand description

A generic value enum

Variants§

§

Bytes(Arc<[u8]>)

§

Email(Arc<EmailAddress>)

§

Id(Id)

§

None

§

Number(Number)

§

String(TCString)

§

Tuple(Tuple<Self>)

§

Version(Version)

Implementations§

Source§

impl Value

Source

pub fn expect_none(&self) -> TCResult<()>

Return a TCError if this Value is not none.

Source

pub fn is_none(&self) -> bool

Return true if this Value is a default Link, Value::None, or empty Tuple.

Source

pub fn is_some(&self) -> bool

Return true if this value is not a default Link, Value::None, or empty Tuple.

Source

pub fn is_tuple(&self) -> bool

Return true if this Value variant is a Tuple.

Source

pub fn into_type(self, class: ValueType) -> Option<Self>

Trait Implementations§

Source§

impl AsType<Arc<[u8]>> for Value

Source§

fn as_type(&self) -> Option<&Arc<[u8]>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut Arc<[u8]>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<Arc<[u8]>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<Arc<EmailAddress>> for Value

Source§

fn as_type(&self) -> Option<&Arc<EmailAddress>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut Arc<EmailAddress>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<Arc<EmailAddress>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<Id> for Value

Source§

fn as_type(&self) -> Option<&Id>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut Id>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<Id>

Convert this instance into an instance of T if possible.
Source§

impl AsType<Link> for Value

Source§

fn as_type(&self) -> Option<&Link>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut Link>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<Link>

Convert this instance into an instance of T if possible.
Source§

impl AsType<Number> for Value

Source§

fn as_type(&self) -> Option<&Number>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut Number>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<Number>

Convert this instance into an instance of T if possible.
Source§

impl AsType<TCString> for Value

Source§

fn as_type(&self) -> Option<&TCString>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut TCString>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<TCString>

Convert this instance into an instance of T if possible.
Source§

impl AsType<Tuple<Value>> for Value

Source§

fn as_type(&self) -> Option<&Tuple<Value>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut Tuple<Value>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<Tuple<Value>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<Version> for Value

Source§

fn as_type(&self) -> Option<&Version>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut Version>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<Version>

Convert this instance into an instance of T if possible.
Source§

impl<T1: CastInto<Value>, T2: CastInto<Value>> CastFrom<(T1, T2)> for Value

Source§

fn cast_from(value: (T1, T2)) -> Self

Cast an instance of T into an instance of Self.
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 Default for Value

Source§

fn default() -> Self

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

Source§

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

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

impl<const N: usize> From<[u8; N]> for Value

Source§

fn from(bytes: [u8; N]) -> Self

Converts to this type from the input type.
Source§

impl From<()> for Value

Source§

fn from(_: ()) -> Value

Converts to this type from the input type.
Source§

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

Source§

fn from(t: Arc<[u8]>) -> Self

Converts to this type from the input type.
Source§

impl From<Arc<EmailAddress>> for Value

Source§

fn from(t: Arc<EmailAddress>) -> Self

Converts to this type from the input type.
Source§

impl From<Bytes> for Value

Source§

fn from(bytes: Bytes) -> Self

Converts to this type from the input type.
Source§

impl From<Host> for Value

Source§

fn from(host: Host) -> Self

Converts to this type from the input type.
Source§

impl From<Id> for Value

Source§

fn from(t: Id) -> Self

Converts to this type from the input type.
Source§

impl From<Link> for Value

Source§

fn from(t: Link) -> Self

Converts to this type from the input type.
Source§

impl From<Number> for Value

Source§

fn from(t: Number) -> Self

Converts to this type from the input type.
Source§

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

Source§

fn from(opt: Option<T>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl From<PathBuf> for Value

Source§

fn from(path: TCPathBuf) -> Value

Converts to this type from the input type.
Source§

impl From<TCString> for Value

Source§

fn from(t: TCString) -> Self

Converts to this type from the input type.
Source§

impl From<Tuple<Value>> for Value

Source§

fn from(t: Tuple<Value>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Value>> for Value

Source§

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

Converts to this type from the input type.
Source§

impl From<Version> for Value

Source§

fn from(t: Version) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(b: bool) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(n: i64) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(n: u64) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Value

Source§

fn from(n: usize) -> Self

Converts to this type from the input type.
Source§

impl<T> FromIterator<T> for Value
where Value: From<T>,

Source§

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

Creates a value from an iterator. Read more
Source§

impl FromStream for Value

Source§

type Context = ()

The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
Source§

fn from_stream<'life0, 'async_trait, D>( _context: (), decoder: &'life0 mut D, ) -> Pin<Box<dyn Future<Output = Result<Self, D::Error>> + Send + 'async_trait>>
where D: 'async_trait + Decoder, Self: 'async_trait, 'life0: 'async_trait,

Parse this value using the given Decoder.
Source§

impl GetSize for Value

Source§

fn get_size(&self) -> usize

Determines the total size of the object. Read more
Source§

fn get_stack_size() -> usize

Determines how may bytes this object occupies inside the stack. Read more
Source§

fn get_heap_size(&self) -> usize

Determines how many bytes this object occupies inside the heap. Read more
Source§

impl<'a, D: Digest> Hash<D> for &'a Value

Source§

fn hash(self) -> Output<D>

Compute the SHA-2 hash of this value
Source§

impl<D: Digest> Hash<D> for Value

Source§

fn hash(self) -> Output<D>

Compute the SHA-2 hash of this value
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 Instance for Value

Source§

type Class = ValueType

The Class type of this instance
Source§

fn class(&self) -> ValueType

Returns the [Class] of this instance.
Source§

impl<'en> IntoStream<'en> for Value

Source§

fn into_stream<E: Encoder<'en>>(self, encoder: E) -> Result<E::Ok, E::Error>

Take ownership of this value and serialize it into the given encoder.
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<'en> ToStream<'en> for Value

Source§

fn to_stream<E: Encoder<'en>>(&'en self, encoder: E) -> Result<E::Ok, E::Error>

Serialize this value into the given encoder.
Source§

impl<T: TryCastFrom<Value>> TryCastFrom<Value> for (T,)

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<T1: TryCastFrom<Value>, T2: TryCastFrom<Value>> TryCastFrom<Value> for (T1, T2)

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<T1: TryCastFrom<Value>, T2: TryCastFrom<Value>, T3: TryCastFrom<Value>> TryCastFrom<Value> for (T1, T2, T3)

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Arc<[u8]>

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Arc<EmailAddress>

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Bound<Value>

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Bound<Value>>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Bytes

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Bytes>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Float

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Host

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Id

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<T: Clone + TryCastFrom<Value>> TryCastFrom<Value> for Map<T>

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Number

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<const N: usize, T> TryCastFrom<Value> for SmallVec<[T; N]>
where T: TryCastFrom<Value>, [T; N]: Array<Item = T>,

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for String

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for TCPathBuf

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for TCString

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<T: Clone + TryCastFrom<Value>> TryCastFrom<Value> for Tuple<T>

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Uuid

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for ValueType

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<T: TryCastFrom<Value>> TryCastFrom<Value> for Vec<T>

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for Version

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for bool

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for f32

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for f64

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for i16

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for i32

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for i64

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for u16

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for u32

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for u64

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for u8

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl TryCastFrom<Value> for usize

Source§

fn can_cast_from(value: &Value) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(value: Value) -> Option<Self>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<T: TryFrom<Value>> TryFrom<Value> for (Id, T)
where TCError: From<T::Error>,

Source§

type Error = TCError

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

fn try_from(value: Value) -> TCResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for Arc<[u8]>

Source§

type Error = TCError

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for Id

Source§

type Error = TCError

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

fn try_from(value: Value) -> TCResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for Map<Value>

Source§

type Error = TCError

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

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

Performs the conversion.
Source§

impl TryFrom<Value> for Number

Source§

type Error = TCError

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

fn try_from(value: Value) -> TCResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for Tuple<Value>

Source§

type Error = TCError

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

fn try_from(value: Value) -> TCResult<Self>

Performs the conversion.
Source§

impl TryFrom<Value> for bool

Source§

type Error = TCError

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

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

Performs the conversion.
Source§

impl Eq 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<F, T> CastFrom<F> for T
where T: From<F>,

Source§

fn cast_from(f: F) -> T

Cast an instance of T into an instance of Self.
Source§

impl<T, F> CastInto<F> for T
where F: CastFrom<T>,

Source§

fn cast_into(self) -> F

Cast an instance of Self into an instance of T.
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<F> Match for F

Source§

fn matches<T>(&self) -> bool
where T: TryCastFrom<Self>,

Returns true if self can be cast into the target type T.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

impl<F, T> TryCastFrom<F> for T
where T: CastFrom<F>,

Source§

fn can_cast_from(_: &F) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(f: F) -> Option<T>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<F, T> TryCastInto<T> for F
where T: TryCastFrom<F>,

Source§

fn can_cast_into(&self) -> bool

Test if self can be cast into T.
Source§

fn opt_cast_into(self) -> Option<T>

Returns Some(T) if self can be cast into T, otherwise None.
Source§

fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>
where OnErr: FnOnce(&Self) -> Err,

Returns Ok(T) if self can be cast into T, otherwise calls on_err.
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>,

Source§

impl<T> ThreadSafe for T
where T: Send + Sync + 'static,