Enum tc_value::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 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

§

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

§

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

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

§

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 Id

§

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>

§

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

§

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>

§

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

§

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

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

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

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

source§

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