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 [Id]s 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.

Object Safety§

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