pub struct Gate(CancellationToken);Expand description
A cheap, clonable release handle the engine awaits.
Level-triggered: releasing before anyone waits is observed by every later waiter, so there is no lost-wakeup race. All clones share one release, and the handle is eight bytes.
The engine never awaits a gate on its own — it always races the gate
against session cancellation and EgressConfig::max_hold, so a hook
that never releases cannot make a stream unkillable.
Deliberately a newtype rather than an exposed CancellationToken:
handing the engine the session’s own cancel token would conflate
teardown with object release.
Tuple Fields§
§0: CancellationTokenImplementations§
Source§impl Gate
impl Gate
Sourcepub fn is_released(&self) -> bool
pub fn is_released(&self) -> bool
Whether Self::release has been called.
Sourcepub(crate) async fn wait(&self)
pub(crate) async fn wait(&self)
Resolve once the gate is released. Engine-internal: callers race it
against session cancellation and EgressConfig::max_hold.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Gate
impl RefUnwindSafe for Gate
impl Send for Gate
impl Sync for Gate
impl Unpin for Gate
impl UnsafeUnpin for Gate
impl UnwindSafe for Gate
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
Mutably borrows from an owned value. Read more