Skip to main content

CapWindow

Struct CapWindow 

Source
pub struct CapWindow {
    pub label: Option<String>,
    pub passed: bool,
    pub timed: bool,
    pub retrying: bool,
}
Expand description

When a capped session’s window reopens and whether it has: the one answer the badge and the nudge sweep both read, resolved from the two sources that can give it (DESIGN.md §8).

The account’s own reading decides whenever there is one. It is the same quantity the screen states, minus the ambiguity: a bare 6:40pm carries no date, so “has it passed?” is answered by nearest occurrence and is a half-day guess in both directions, while an instant is simply compared. The screen parse remains the answer for an agent with no cap verb, for an account that is not itself refused, and for every reading taken before the verb has run.

One caveat rides the precedence and is worth naming: an account is refused by one window while a session may be held by another — a weekly model limit behind a five-hour account cap — and the account reading names its own. The sweep is then early for that session, which §8 already prices as the cheap failure: the nudge lands, the turn re-caps at once, and the badge returns.

Fields§

§label: Option<String>

The reset as a local 21:50, absent when neither source named one.

§passed: bool

Whether the window has reopened.

§timed: bool

Whether anything named a reset at all. A cap with no time is the case the operator’s own judgement stands in for (CapWindow::due).

§retrying: bool

Whether the session is retrying the rejected request rather than sitting on it (CapReading::retrying). Carried through rather than resolved away, because it is the one badged shape that wants nothing done about it and the badge has to say so.

Implementations§

Source§

impl CapWindow

Source

pub fn resolve( reading: &CapReading, account: Option<&AccountCap>, now_minutes: Option<u16>, now_epoch: Option<i64>, ) -> CapWindow

Resolve the sources for one session, the account’s reading first.

A session that is retrying takes neither: the account’s instant says when the window reopens, and a retrying session is not waiting on the window — it is mid-turn on a request of its own, and the time it names is when that request goes out (§8). Reading an account instant onto it would mark it due the moment the window opened, which is precisely the session a nudge must not touch.

Source

pub fn due(&self) -> bool

Whether this session is waiting on a human rather than on the clock — what the sweep nudges.

An untimed cap counts, and that is the operator’s judgement standing in for the clock’s: they pressed the key, and a nudge that turns out to be early is refused by the agent rather than doing harm (§8). It is also the gap the account reading closes — a cap whose time never parsed is timed after all once the account has said when — which is what an automatic sweep, with no keypress behind it, needs.

A retrying session is never due, whatever it named: it is working, and the sweep stops its target before resuming it, so a nudge there ends a turn rather than adding one. That answer lives here rather than only in the sweep, so a caller reading due alone cannot miss it.

Trait Implementations§

Source§

impl Clone for CapWindow

Source§

fn clone(&self) -> CapWindow

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 CapWindow

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for CapWindow

Source§

fn default() -> CapWindow

Returns the “default value” for a type. Read more
Source§

impl Eq for CapWindow

Source§

impl PartialEq for CapWindow

Source§

fn eq(&self, other: &CapWindow) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CapWindow

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.