pub struct FrictionPause {
pub command: Command,
pub level: FrictionLevel,
pub started_at: Instant,
pub pause: Duration,
pub confirm_word: Option<String>,
pub confirm_input: String,
}Expand description
Live state of a friction-pause overlay.
The overlay’s lifecycle in M1:
- Dispatcher returns
FrictionDecision::Pause | TypedConfirmpluspending_command = Some(cmd). AppState::apply_dispatchopens aFrictionPausewithstarted_at = now.- The TUI render path draws a countdown + (L2) an input box.
- Operator hits
Esc→AppState::dismiss_overlay; the pending command is discarded. - L1: the event loop’s tick handler polls [
is_complete]; when the pause elapses the overlay is closed and the command is re-dispatched withzero_commands::run_bypass_friction. - L2: the operator types into
confirm_input; when the pause has also elapsed and the buffer matchesconfirm_word, the same completion path runs. Typing the word before the pause ends does nothing — the pause is mandatory (§3, Addendum A). The widget dims the input during the pause to make this visible.
Fields§
§command: Command§level: FrictionLevel§started_at: Instant§pause: Duration§confirm_word: Option<String>The word the operator must type at L2+. None at L1 (the
pause alone is the gate).
confirm_input: StringOperator’s in-progress typed confirmation. Empty at open. Only mutated at L2+; input handling ignores it at L1.
Implementations§
Source§impl FrictionPause
impl FrictionPause
pub fn from_decision( command: Command, decision: &FrictionDecision, now: Instant, ) -> Option<Self>
Sourcepub fn remaining(&self, now: Instant) -> Duration
pub fn remaining(&self, now: Instant) -> Duration
Remaining pause duration at now. Zero when the pause has
elapsed. Saturating so callers don’t see negatives.
Sourcepub fn pause_elapsed(&self, now: Instant) -> bool
pub fn pause_elapsed(&self, now: Instant) -> bool
Whether the mandatory pause window has elapsed. True gates the typed-confirm input at L2+.
Sourcepub fn confirm_word_matches(&self) -> bool
pub fn confirm_word_matches(&self) -> bool
Whether the operator’s typed input matches the confirm
word. Case-sensitive (matches the constant in
zero-commands), trimmed. Always false at L1.
Sourcepub fn outcome(&self, now: Instant) -> FrictionOutcome
pub fn outcome(&self, now: Instant) -> FrictionOutcome
Evaluate completion state. The return discriminates only between “ready to re-dispatch” and “still pending” — cancellation is a separate path (the overlay is simply dismissed). At L1 the pause alone completes the gate. At L2+ both the pause and the typed confirmation are required.
Trait Implementations§
Source§impl Clone for FrictionPause
impl Clone for FrictionPause
Source§fn clone(&self) -> FrictionPause
fn clone(&self) -> FrictionPause
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for FrictionPause
impl RefUnwindSafe for FrictionPause
impl Send for FrictionPause
impl Sync for FrictionPause
impl Unpin for FrictionPause
impl UnsafeUnpin for FrictionPause
impl UnwindSafe for FrictionPause
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more