Enum routing::walk_state::WalkState
source · pub enum WalkState<T: WalkStateUnit + Debug + Clone> {
Begin,
Intermediate(T),
Finished(T),
}
Expand description
WalkState contains all information required to traverse offer and expose chains in a tree tracing routes from any point back to their originating source. This includes in the most complex case traversing from a use to offer chain, back through to an expose chain.
Variants§
Implementations§
source§impl<T: WalkStateUnit + Debug + Clone> WalkState<T>
impl<T: WalkStateUnit + Debug + Clone> WalkState<T>
sourcepub fn at(state: T) -> Self
pub fn at(state: T) -> Self
Constructs a new WalkState representing the start of a walk after a hard coded initial node. Used to represent framework state with static state definitions such as rights in directories or filters in events.
sourcepub fn advance(&self, next_state: Option<T>) -> Result<Self, RoutingError>
pub fn advance(&self, next_state: Option<T>) -> Result<Self, RoutingError>
Advances the WalkState if and only if the state passed satisfies the validation.
sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether or not the state is Finished.
sourcepub fn finalize(&self, state: Option<T>) -> Result<Self, RoutingError>
pub fn finalize(&self, state: Option<T>) -> Result<Self, RoutingError>
Finalizes the state preventing future modification, this is called when the walker arrives at a node with a source of Framework, Builtin, Namespace or Self. The provided |state| should always be the state at the CapabilitySource.