Skip to main content

ReductionContext

Struct ReductionContext 

Source
pub struct ReductionContext {
    pub views: IndexMap<CaseKey, ErasedWorkflowView>,
    pub active_interactions: Vec<ActiveInteractionSummary>,
    pub target_map: TargetTokenMap,
    pub operations: OperationCatalog,
    pub policy: PolicySnapshot,
    pub limits: PlanLimits,
    pub now: DateTime<Utc>,
    pub confirm_every_write: BTreeSet<CaseKey>,
    pub subject_only_when_named: BTreeSet<CaseKey>,
}
Expand description

Everything the reducer sees besides the plan and the turn.

Fields§

§views: IndexMap<CaseKey, ErasedWorkflowView>

Projected views of every loaded case.

§active_interactions: Vec<ActiveInteractionSummary>

Active interactions in the conversation.

§target_map: TargetTokenMap

Tokens issued for this turn.

§operations: OperationCatalog

Operations offered for this turn.

§policy: PolicySnapshot

Policy configuration.

§limits: PlanLimits

Plan limits.

§now: DateTime<Utc>

The clock value the reducer must use (it must not read the clock).

§confirm_every_write: BTreeSet<CaseKey>

The cases every write on which has to pass through a click.

Set by the application, per case, through its case directory. A command on one of these that would otherwise have run silently gets the confirmation raised instead, on a card that names the case — the same thing ConstraintKind::AskBeforeApplying does when a user asks for it. Empty is the ordinary case and changes nothing.

§subject_only_when_named: BTreeSet<CaseKey>

The cases that are in view only because the actor may reach them.

Set by the application, per case, through its case directory: a record another conversation is filling in, one left open in a thread that no longer exists, anything the turn has in view because it is reachable rather than because this turn is about it.

What it does is keep such a case from acting as a subject on its own. It is not hidden and not unreachable — it stays in the catalog under its own names, and the moment an act of this turn lands on it it is a subject like any other, which is the only way a draft left in a deleted conversation can ever be finished. What it stops is the three things a case does merely by being in the room: holding the door against a second case beside it, briefing the writer in the imperative, and putting its own outstanding fields in front of a reader answering about something else.

Empty is the ordinary case and changes nothing.

Implementations§

Source§

impl ReductionContext

Source

pub fn view_for(&self, key: &CaseKey) -> Option<&ErasedWorkflowView>

View of a case, if loaded.

Source

pub fn confirms_every_write(&self, key: &CaseKey) -> bool

Whether every write on key has to pass through a click.

Source

pub fn is_subject_only_when_named(&self, key: &CaseKey) -> bool

Whether key is in view only because the actor may reach it, so it is a subject of this turn only if the turn names it.

See Self::subject_only_when_named.

Source

pub fn blocking_interaction_for( &self, key: &CaseKey, ) -> Option<&ActiveInteractionSummary>

The active blocking interaction of a case, if any.

Trait Implementations§

Source§

impl Clone for ReductionContext

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReductionContext

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.