Trait Refer

Source
pub trait Refer<State: StateInstance> {
    // Required methods
    fn dereference_self(self, path: &TCPathBuf) -> Self;
    fn is_conditional(&self) -> bool;
    fn is_inter_service_write(&self, cluster_path: &[PathSegment]) -> bool;
    fn is_ref(&self) -> bool;
    fn reference_self(self, path: &TCPathBuf) -> Self;
    fn requires(&self, deps: &mut HashSet<Id>);
    fn resolve<'a, 'async_trait, T>(
        self,
        context: &'a Scope<'a, State, T>,
        txn: &'a State::Txn,
    ) -> Pin<Box<dyn Future<Output = TCResult<State>> + Send + 'async_trait>>
       where T: 'async_trait + ToState<State> + Public<State> + Instance,
             Self: 'async_trait,
             'a: 'async_trait;
}
Expand description

Trait defining dependencies and a resolution method for a TCRef.

Required Methods§

Source

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

Replace references to “$self” with the given relative path.

This is used to control whether or not an OpDef will be replicated.

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

This is used to control whether or not an OpDef will be replicated.

Source

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

Add the dependency Ids of this reference to the given set.

Source

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

Resolve this reference with respect to the given context.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<State> Refer<State> for Scalar
where State: StateInstance + Refer<State> + From<Scalar>, State::Closure: From<(Map<State>, OpDef)> + TryCastFrom<State>, Map<State>: TryFrom<State, Error = TCError>, Value: TryFrom<State, Error = TCError> + TryCastFrom<State>, bool: TryCastFrom<State>,

Source§

impl<State> Refer<State> for TCRef
where State: StateInstance + Refer<State> + From<Scalar>, State::Closure: From<(Map<State>, OpDef)> + TryCastFrom<State>, Map<State>: TryFrom<State, Error = TCError>, Value: TryFrom<State, Error = TCError> + TryCastFrom<State>, bool: TryCastFrom<State>,

Source§

impl<State> Refer<State> for OpRef
where State: StateInstance + Refer<State> + From<Scalar>, State::Closure: From<(Map<State>, OpDef)> + TryCastFrom<State>, Map<State>: TryFrom<State, Error = TCError>, Value: TryFrom<State, Error = TCError> + TryCastFrom<State>, bool: TryCastFrom<State>,

Source§

impl<State> Refer<State> for IdRef
where State: StateInstance + Refer<State>,

Source§

impl<State> Refer<State> for After
where State: StateInstance + Refer<State> + From<Scalar>, State::Closure: From<(Map<State>, OpDef)> + TryCastFrom<State>, Map<State>: TryFrom<State, Error = TCError>, Value: TryFrom<State, Error = TCError> + TryCastFrom<State>, bool: TryCastFrom<State>,

Source§

impl<State> Refer<State> for Case
where State: StateInstance + Refer<State> + From<Scalar>, State::Closure: From<(Map<State>, OpDef)> + TryCastFrom<State>, Map<State>: TryFrom<State, Error = TCError>, Value: TryFrom<State, Error = TCError> + TryCastFrom<State>, bool: TryCastFrom<State>,

Source§

impl<State> Refer<State> for IfRef
where State: StateInstance + Refer<State> + From<Scalar>, State::Closure: From<(Map<State>, OpDef)> + TryCastFrom<State>, Map<State>: TryFrom<State, Error = TCError>, Value: TryFrom<State, Error = TCError> + TryCastFrom<State>, bool: TryCastFrom<State>,

Source§

impl<State> Refer<State> for While
where State: StateInstance + Refer<State> + From<Scalar>, State::Closure: From<(Map<State>, OpDef)> + TryCastFrom<State>, Map<State>: TryFrom<State, Error = TCError>, Value: TryFrom<State, Error = TCError> + TryCastFrom<State>, bool: TryCastFrom<State>,

Source§

impl<State> Refer<State> for With
where State: StateInstance + Refer<State> + From<Scalar>, State::Closure: From<(Map<State>, OpDef)> + TryCastFrom<State>, Map<State>: TryFrom<State, Error = TCError>, Value: TryFrom<State, Error = TCError> + TryCastFrom<State>, bool: TryCastFrom<State>,