pub struct DefaultTurnReducer { /* private fields */ }Expand description
The deterministic whole-turn reducer of §13. Build one per turn.
Implementations§
Source§impl DefaultTurnReducer
impl DefaultTurnReducer
Sourcepub fn new(
workflows: impl Into<WorkflowDefinitions>,
resolver: TargetResolver,
policy: PolicyEngine,
config: &OrchestratorConfig,
) -> Self
pub fn new( workflows: impl Into<WorkflowDefinitions>, resolver: TargetResolver, policy: PolicyEngine, config: &OrchestratorConfig, ) -> Self
Builds a reducer for one turn: resolver carries the tokens and the card on
screen, policy the mode and the card copy, config the execution and
narration sections.
Sourcepub fn with_state(self, case: CaseKey, state: Value) -> Self
pub fn with_state(self, case: CaseKey, state: Value) -> Self
Adds the loaded state of one case. A case with no entry compiles against None,
which is what a case that does not exist yet looks like.
Sourcepub fn with_states(
self,
states: impl IntoIterator<Item = (CaseKey, Value)>,
) -> Self
pub fn with_states( self, states: impl IntoIterator<Item = (CaseKey, Value)>, ) -> Self
Adds several loaded states.
Sourcepub fn with_confirmed_origin(self, origin: CommandOrigin, act: ActId) -> Self
pub fn with_confirmed_origin(self, origin: CommandOrigin, act: ActId) -> Self
Declares the origin a card answer minted, for the one act the card itself put into the plan. No other act receives it (I12).
Sourcepub fn with_copy(self, copy: NoticeCopy) -> Self
pub fn with_copy(self, copy: NoticeCopy) -> Self
Replaces the notices the reducer writes itself. The shipped copy is English.
Sourcepub const fn resolver(&self) -> &TargetResolver
pub const fn resolver(&self) -> &TargetResolver
The resolver this reducer was built with.
Source§impl DefaultTurnReducer
impl DefaultTurnReducer
Sourcepub fn reduce_turn(
&self,
input: &TurnInput,
understanding: &Understanding,
context: &ReductionContext,
) -> Result<ReducedTurn, ReductionError>
pub fn reduce_turn( &self, input: &TurnInput, understanding: &Understanding, context: &ReductionContext, ) -> Result<ReducedTurn, ReductionError>
Reduces one turn, keeping the envelopes its confirmation cards will authorize.
§Errors
Whatever TurnReducer::reduce returns.
Trait Implementations§
Source§impl Clone for DefaultTurnReducer
impl Clone for DefaultTurnReducer
Source§impl Debug for DefaultTurnReducer
impl Debug for DefaultTurnReducer
Source§impl TurnReducer for DefaultTurnReducer
impl TurnReducer for DefaultTurnReducer
Source§fn reduce(
&self,
input: &TurnInput,
understanding: &Understanding,
context: &ReductionContext,
) -> Result<ReductionPlan, ReductionError>
fn reduce( &self, input: &TurnInput, understanding: &Understanding, context: &ReductionContext, ) -> Result<ReductionPlan, ReductionError>
Reduces one understood turn into an execution plan. Must be deterministic for
the same inputs and must not perform I/O. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for DefaultTurnReducer
impl !UnwindSafe for DefaultTurnReducer
impl Freeze for DefaultTurnReducer
impl Send for DefaultTurnReducer
impl Sync for DefaultTurnReducer
impl Unpin for DefaultTurnReducer
impl UnsafeUnpin for DefaultTurnReducer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more