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: boolWhether the window has reopened.
timed: boolWhether 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: boolWhether 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
impl CapWindow
Sourcepub fn resolve(
reading: &CapReading,
account: Option<&AccountCap>,
now_minutes: Option<u16>,
now_epoch: Option<i64>,
) -> CapWindow
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.
Sourcepub fn due(&self) -> bool
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§
impl Eq for CapWindow
impl StructuralPartialEq for CapWindow
Auto Trait Implementations§
impl Freeze for CapWindow
impl RefUnwindSafe for CapWindow
impl Send for CapWindow
impl Sync for CapWindow
impl Unpin for CapWindow
impl UnsafeUnpin for CapWindow
impl UnwindSafe for CapWindow
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.