Enum tc_state::State

source ·
pub enum State {
    Collection(Collection),
    Chain(Chain<CollectionBase>),
    Closure(Closure),
    Map(Map<Self>),
    Object(Object),
    Scalar(Scalar),
    Tuple(Tuple<Self>),
}
Expand description

An addressable state with a discrete value per-transaction.

Variants§

§

Collection(Collection)

§

Chain(Chain<CollectionBase>)

§

Closure(Closure)

§

Map(Map<Self>)

§

Object(Object)

§

Scalar(Scalar)

§

Tuple(Tuple<Self>)

Implementations§

source§

impl State

source

pub fn is_none(&self) -> bool

Return true if this State is an empty Tuple or Map, default [Link], or Value::None

source

pub fn is_some(&self) -> bool

Return false if this State is an empty Tuple or Map, default [Link], or Value::None

source

pub fn is_ref(&self) -> bool

Return true if this State is a reference that needs to be resolved.

source

pub fn try_into_map<Err, OnErr: Fn(State) -> Err>( self, err: OnErr ) -> Result<Map<State>, Err>

Return this State as a Map of States, or an error if this is not possible.

source

pub fn try_into_tuple<Err: Fn(State) -> TCError>( self, err: Err ) -> TCResult<Tuple<State>>

Return this State as a Map of States, or an error if this is not possible.

Trait Implementations§

source§

impl AsyncHash for State

source§

fn hash<'async_trait>( self, txn_id: TxnId ) -> Pin<Box<dyn Future<Output = TCResult<Output<Sha256>>> + Send + 'async_trait>>
where Self: 'async_trait,

Compute the hash of this state as of a given TxnId
source§

impl<T1> CastFrom<(T1,)> for State
where State: CastFrom<T1>,

source§

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

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

impl<T1, T2> CastFrom<(T1, T2)> for State
where State: CastFrom<T1> + CastFrom<T2>,

source§

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

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

impl<T1, T2, T3> CastFrom<(T1, T2, T3)> for State
where State: CastFrom<T1> + CastFrom<T2> + CastFrom<T3>,

source§

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

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

impl<T1, T2, T3, T4> CastFrom<(T1, T2, T3, T4)> for State
where State: CastFrom<T1> + CastFrom<T2> + CastFrom<T3> + CastFrom<T4>,

source§

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

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

impl Clone for State

source§

fn clone(&self) -> State

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 ClosureInstance<State> for Closure

source§

fn call<'async_trait>( self: Box<Self>, txn: Txn, args: State ) -> Pin<Box<dyn Future<Output = TCResult<State>> + Send + 'async_trait>>
where Self: 'async_trait,

Execute this ClosureInstance with the given args
source§

impl Debug for State

source§

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

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

impl Default for State

source§

fn default() -> Self

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

impl From<()> for State

source§

fn from(_: ()) -> State

Converts to this type from the input type.
source§

impl From<BTree<Txn<State>, CacheBlock>> for State

source§

fn from(btree: BTree) -> Self

Converts to this type from the input type.
source§

impl From<BlockChain<State, CollectionBase<Txn<State>, CacheBlock>>> for State

source§

fn from(chain: BlockChain<CollectionBase>) -> Self

Converts to this type from the input type.
source§

impl From<Box<TCRef>> for State

source§

fn from(tc_ref: Box<TCRef>) -> Self

Converts to this type from the input type.
source§

impl From<Chain<State, CollectionBase<Txn<State>, CacheBlock>>> for State

source§

fn from(chain: Chain<CollectionBase>) -> Self

Converts to this type from the input type.
source§

impl From<Closure> for State

source§

fn from(closure: Closure) -> Self

Converts to this type from the input type.
source§

impl From<Collection<Txn<State>, CacheBlock>> for State

source§

fn from(collection: Collection) -> Self

Converts to this type from the input type.
source§

impl From<CollectionBase<Txn<State>, CacheBlock>> for State

source§

fn from(collection: CollectionBase) -> Self

Converts to this type from the input type.
source§

impl From<Host> for State

source§

fn from(host: Host) -> Self

Converts to this type from the input type.
source§

impl From<Id> for State

source§

fn from(id: Id) -> Self

Converts to this type from the input type.
source§

impl From<InstanceClass> for State

source§

fn from(class: InstanceClass) -> Self

Converts to this type from the input type.
source§

impl From<Link> for State

source§

fn from(link: Link) -> Self

Converts to this type from the input type.
source§

impl From<Map<InstanceClass>> for State

source§

fn from(map: Map<InstanceClass>) -> Self

Converts to this type from the input type.
source§

impl From<Map<Scalar>> for State

source§

fn from(map: Map<Scalar>) -> Self

Converts to this type from the input type.
source§

impl From<Map<State>> for State

source§

fn from(map: Map<State>) -> Self

Converts to this type from the input type.
source§

impl From<Number> for State

source§

fn from(n: Number) -> Self

Converts to this type from the input type.
source§

impl From<Object> for State

source§

fn from(object: Object) -> Self

Converts to this type from the input type.
source§

impl From<OpDef> for State

source§

fn from(op_def: OpDef) -> Self

Converts to this type from the input type.
source§

impl From<OpRef> for State

source§

fn from(op_ref: OpRef) -> Self

Converts to this type from the input type.
source§

impl<T> From<Option<T>> for State
where State: From<T>,

source§

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

Converts to this type from the input type.
source§

impl From<Scalar> for State

source§

fn from(scalar: Scalar) -> Self

Converts to this type from the input type.
source§

impl From<StateType> for State

source§

fn from(class: StateType) -> Self

Converts to this type from the input type.
source§

impl From<TCRef> for State

source§

fn from(tc_ref: TCRef) -> Self

Converts to this type from the input type.
source§

impl From<Table<Txn<State>, CacheBlock>> for State

source§

fn from(table: Table) -> Self

Converts to this type from the input type.
source§

impl From<Tensor<Txn<State>, CacheBlock>> for State

source§

fn from(tensor: Tensor) -> Self

Converts to this type from the input type.
source§

impl From<Tuple<Scalar>> for State

source§

fn from(tuple: Tuple<Scalar>) -> Self

Converts to this type from the input type.
source§

impl From<Tuple<State>> for State

source§

fn from(tuple: Tuple<State>) -> Self

Converts to this type from the input type.
source§

impl From<Tuple<Value>> for State

source§

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

Converts to this type from the input type.
source§

impl From<Value> for State

source§

fn from(value: Value) -> Self

Converts to this type from the input type.
source§

impl From<bool> for State

source§

fn from(b: bool) -> Self

Converts to this type from the input type.
source§

impl From<i64> for State

source§

fn from(n: i64) -> Self

Converts to this type from the input type.
source§

impl From<u64> for State

source§

fn from(n: u64) -> Self

Converts to this type from the input type.
source§

impl From<usize> for State

source§

fn from(n: usize) -> Self

Converts to this type from the input type.
source§

impl FromStream for State

§

type Context = Txn<State>

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>( txn: Txn, 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<'a> Handler<'a, State> for Closure

source§

fn get<'b>(self: Box<Self>) -> Option<GetHandler<'a, 'b, Txn, State>>
where 'b: 'a,

source§

fn put<'b>(self: Box<Self>) -> Option<PutHandler<'a, 'b, Txn, State>>
where 'b: 'a,

source§

fn post<'b>(self: Box<Self>) -> Option<PostHandler<'a, 'b, Txn, State>>
where 'b: 'a,

source§

fn delete<'b>(self: Box<Self>) -> Option<DeleteHandler<'a, 'b, Txn>>
where 'b: 'a,

source§

impl Instance for State

§

type Class = StateType

The Class type of this instance
source§

fn class(&self) -> StateType

Returns the [Class] of this instance.
source§

impl<'en> IntoView<'en, CacheBlock> for State

§

type Txn = Txn<State>

The type of Transaction which this state supports
§

type View = StateView<'en>

The type of encodable view returned by into_view
source§

fn into_view<'async_trait>( self, txn: Self::Txn ) -> Pin<Box<dyn Future<Output = TCResult<Self::View>> + Send + 'async_trait>>
where Self: 'async_trait,

Return a View which can be encoded with en::IntoStream.
source§

impl Refer<State> for State

source§

fn dereference_self(self, path: &TCPathBuf) -> Self

Replace references to “$self” with the given relative path. Read more
source§

fn is_conditional(&self) -> bool

Return true if this is a conditional reference (e.g. If or Case).
source§

fn is_inter_service_write(&self, cluster_path: &[PathSegment]) -> bool

Return true if this references a write operation to a cluster other than the path given.
source§

fn is_ref(&self) -> bool

Return true if this state is a resolvable reference.
source§

fn reference_self(self, path: &TCPathBuf) -> Self

Replace the given relative path with “$self”. Read more
source§

fn requires(&self, deps: &mut HashSet<Id>)

Add the dependency [Id]s of this reference to the given set.
source§

fn resolve<'a, 'async_trait, T>( self, context: &'a Scope<'a, Self, T>, txn: &'a Txn ) -> Pin<Box<dyn Future<Output = TCResult<Self>> + Send + 'async_trait>>
where T: 'async_trait + ToState<State> + Instance + Public<Self>, Self: 'async_trait, 'a: 'async_trait,

Resolve this reference with respect to the given context.
source§

impl Route<State> for InstanceClass

source§

fn route<'a>( &'a self, path: &'a [PathSegment] ) -> Option<Box<dyn Handler<'a, State> + 'a>>

source§

impl<T: ToState<State> + Instance + Route<State> + Debug> Route<State> for InstanceExt<T>
where Self: ToState<State>,

source§

fn route<'a>( &'a self, path: &'a [PathSegment] ) -> Option<Box<dyn Handler<'a, State> + 'a>>

source§

impl Route<State> for Object

source§

fn route<'a>( &'a self, path: &'a [PathSegment] ) -> Option<Box<dyn Handler<'a, State> + 'a>>

source§

impl Route<State> for ObjectType

source§

fn route<'a>( &'a self, _path: &'a [PathSegment] ) -> Option<Box<dyn Handler<'a, State> + 'a>>

source§

impl Route<State> for State

source§

fn route<'a>( &'a self, path: &'a [PathSegment] ) -> Option<Box<dyn Handler<'a, State> + 'a>>

source§

impl Route<State> for StateType

source§

fn route<'a>( &'a self, path: &'a [PathSegment] ) -> Option<Box<dyn Handler<'a, State> + 'a>>

source§

impl Route<State> for Static

source§

fn route<'a>( &'a self, path: &'a [PathSegment] ) -> Option<Box<dyn Handler<'a, State> + 'a>>

source§

impl StateInstance for State

§

type FE = CacheBlock

§

type Txn = Txn<State>

§

type Closure = Closure

source§

fn is_map(&self) -> bool

Return true if this is a Map of states.
source§

fn is_tuple(&self) -> bool

Return true if this is a Tuple of states.
source§

impl<T: Instance + ToState<State>> ToState<State> for InstanceExt<T>

source§

fn to_state(&self) -> State

source§

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

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State>, T2: TryCastFrom<State>> TryCastFrom<State> for (T1, T2)

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State>, T2: TryCastFrom<State>, T3: TryCastFrom<State>> TryCastFrom<State> for (T1, T2, T3)

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for BTree

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for BlockChain<CollectionBase>

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Box<dyn ClosureInstance<State>>

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Bytes

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Chain<CollectionBase>

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Closure

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Collection

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for CollectionBase

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Float

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Host

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Id

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for IdRef

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for InstanceClass

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> Option<InstanceClass>

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(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State>> TryCastFrom<State> for Map<T>

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Number

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for OpDef

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for OpRef

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Scalar

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for TCPathBuf

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for TCString

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Table

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Tensor

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State>> TryCastFrom<State> for Tuple<T>

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for Value

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State>> TryCastFrom<State> for Vec<T>

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for bool

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for u64

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> for usize

source§

fn can_cast_from(state: &State) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(state: State) -> 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<State> + TryFrom<Scalar>> TryFrom<State> for (Id, T)
where TCError: From<<T as TryFrom<State>>::Error> + From<<T as TryFrom<Scalar>>::Error>,

§

type Error = TCError

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

fn try_from(state: State) -> TCResult<Self>

Performs the conversion.
source§

impl TryFrom<State> for Collection

§

type Error = TCError

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

fn try_from(state: State) -> TCResult<Collection>

Performs the conversion.
source§

impl TryFrom<State> for Id

§

type Error = TCError

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

fn try_from(state: State) -> TCResult<Id>

Performs the conversion.
source§

impl TryFrom<State> for Map<Scalar>

§

type Error = TCError

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

fn try_from(state: State) -> TCResult<Map<Scalar>>

Performs the conversion.
source§

impl TryFrom<State> for Map<State>

§

type Error = TCError

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

fn try_from(state: State) -> TCResult<Map<State>>

Performs the conversion.
source§

impl TryFrom<State> for Map<Value>

§

type Error = TCError

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

fn try_from(state: State) -> TCResult<Map<Value>>

Performs the conversion.
source§

impl TryFrom<State> for Scalar

§

type Error = TCError

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

fn try_from(state: State) -> TCResult<Self>

Performs the conversion.
source§

impl TryFrom<State> for Tuple<State>

§

type Error = TCError

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

fn try_from(state: State) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<State> for Value

§

type Error = TCError

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

fn try_from(state: State) -> TCResult<Value>

Performs the conversion.
source§

impl TryFrom<State> for bool

§

type Error = TCError

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

fn try_from(state: State) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl !RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl !UnwindSafe for State

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<State, T> Public<State> for T
where State: StateInstance, T: Route<State> + Debug,

source§

fn get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, txn: &'life1 <State as StateInstance>::Txn, path: &'life2 [Id], key: Value ) -> Pin<Box<dyn Future<Output = Result<State, TCError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

source§

fn put<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, txn: &'life1 <State as StateInstance>::Txn, path: &'life2 [Id], key: Value, value: State ) -> Pin<Box<dyn Future<Output = Result<(), TCError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

source§

fn post<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, txn: &'life1 <State as StateInstance>::Txn, path: &'life2 [Id], params: Map<State> ) -> Pin<Box<dyn Future<Output = Result<State, TCError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

source§

fn delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, txn: &'life1 <State as StateInstance>::Txn, path: &'life2 [Id], key: Value ) -> Pin<Box<dyn Future<Output = Result<(), TCError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

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<State, T> ToState<State> for T
where State: StateInstance, T: Clone + Into<State>,

source§

fn to_state(&self) -> State

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> ThreadSafe for T
where T: Send + Sync + 'static,