pub struct Slot {
purpose: &'static Purpose,
entity_id: String,
cancel: CancellationToken,
_permit: Option<SemaphorePermit<'static>>,
_guard: AmbientCallGuard<'static>,
recorded: bool,
queued_ms: u64,
}Expand description
An admitted call. Dropping it (any path) releases the gateway entry and the permit.
Fields§
§purpose: &'static Purpose§entity_id: String§cancel: CancellationToken§_permit: Option<SemaphorePermit<'static>>§_guard: AmbientCallGuard<'static>§recorded: boolSet once this call’s outcome is recorded, so Drop records NotRun only
for a call given up without one: every admitted call ends in exactly one
outcome.
queued_ms: u64Time spent waiting for a concurrency permit after admission.
Implementations§
Source§impl Slot
impl Slot
Sourcepub fn is_superseded(&self) -> bool
pub fn is_superseded(&self) -> bool
Whether a newer request for the same key has been admitted since this one.
Sourcepub fn abandon(self, outcome: Outcome)
pub fn abandon(self, outcome: Outcome)
Give the call up without running it, recording why (for example
EmptyDigest), instead of the NotRun a plain drop records.
Sourcepub async fn run(
self,
target: &CliTarget,
prompt: &str,
judge: impl Fn(&str) -> Verdict,
) -> Reply
pub async fn run( self, target: &CliTarget, prompt: &str, judge: impl Fn(&str) -> Verdict, ) -> Reply
Run the CLI with prompt, within the purpose’s time limit, and let judge
decide what the reply is worth (reply::judge_line for a one-line reply in
the ANSWER:/SKIP format). Never fails: a CLI error, a cancellation, a
skip and a refused reply all come back as a Reply with empty text.
Sourcepub async fn run_held(
&mut self,
target: &CliTarget,
prompt: &str,
judge: impl Fn(&str) -> Verdict,
) -> Reply
pub async fn run_held( &mut self, target: &CliTarget, prompt: &str, judge: impl Fn(&str) -> Verdict, ) -> Reply
Slot::run, keeping the slot, and with it the gateway’s hold on this
call’s generation, for a caller that acts on the reply and must not if a
newer request arrived meanwhile (Slot::is_superseded).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Slot
impl !UnwindSafe for Slot
impl Freeze for Slot
impl Send for Slot
impl Sync for Slot
impl Unpin for Slot
impl UnsafeUnpin for Slot
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<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