pub(crate) struct Grant {
pub id: String,
pub agent: String,
pub origins: Vec<String>,
pub powers: Vec<Power>,
pub minutes: u64,
pub expires: Instant,
pub expires_at_ms: i64,
last_active: Instant,
pub paused_at: Option<Instant>,
pub standing: Option<String>,
}Fields§
§id: StringDistinguishes this grant from a later one on the same pane, so an old expiry timer can’t end a new grant.
agent: String§origins: Vec<String>The bound sites, in allowed_origins normal form.
powers: Vec<Power>What the person allowed: committing clicks always, and any more they were shown.
minutes: u64§expires: Instant§expires_at_ms: i64For the header’s countdown: milliseconds since the Unix epoch.
last_active: InstantThe agent’s last Browser call on the pane, or the grant itself.
paused_at: Option<Instant>Since when the person has paused the pane: the time limit and the idle limit stand still until they resume, then both move later by the paused time.
standing: Option<String>The standing row this grant was made from (browser_standing), for a
grant that has no time limit: revoking the row ends it.
Implementations§
Source§impl Grant
impl Grant
fn live(&self) -> bool
Sourcefn left(&self, now: Instant) -> Duration
fn left(&self, now: Instant) -> Duration
Time left on the clock, which stands still while the pane is paused.
pub(crate) fn minutes_left(&self) -> u64
Sourcefn hold(&mut self, hold: bool, now: Instant) -> bool
fn hold(&mut self, hold: bool, now: Instant) -> bool
Stop (hold) or restart the grant’s clocks at now. Resuming moves
its end and its idle deadline later by the paused time. Returns
whether anything changed.
Sourcefn shorten(&mut self, minutes: u64, now: Instant) -> Option<u64>
fn shorten(&mut self, minutes: u64, now: Instant) -> Option<u64>
Cut the time left to minutes when it is longer: a grant lasts what an agent asked for, or less. A
grant with no time limit (a standing row) is never cut. Returns the minutes it had left, when cut.
pub(crate) fn allows(&self, power: Power) -> bool
Sourcepub(crate) fn satisfies(&self, power: Power) -> bool
pub(crate) fn satisfies(&self, power: Power) -> bool
Does this grant already give what a request for power asks? A grant
that lets the terminal run freely covers a request to use it with a
question per line (the laxer one holds the stricter).
Sourcepub(crate) fn allows_terminal(&self) -> bool
pub(crate) fn allows_terminal(&self) -> bool
May the agent type in a web terminal at all, whether or not each line asks?
Sourcepub(crate) fn asks_each_line(&self) -> bool
pub(crate) fn asks_each_line(&self) -> bool
Does each line need the person’s Run it? The stricter power wins when a grant carries both.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Grant
impl RefUnwindSafe for Grant
impl Send for Grant
impl Sync for Grant
impl Unpin for Grant
impl UnsafeUnpin for Grant
impl UnwindSafe for Grant
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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