pub struct TurnLease { /* private fields */ }Expand description
One talk’s cross-process turn slot, released on drop (success, error, panic or a dropped handler future alike). Release only removes the file while it still carries this lease’s token, so a guard that outlived its own expiry cannot delete the lease of whoever took over.
Implementations§
Source§impl TurnLease
impl TurnLease
Sourcepub fn beat(&self) -> Result<bool>
pub fn beat(&self) -> Result<bool>
Renew the lease. Ok(false) means it was taken over or removed, so
this turn no longer owns the slot; Err is a transient failure (the
lock stayed busy, a write failed) and the next beat tries again.
Sourcepub async fn beating<T>(&self, fut: impl Future<Output = T>) -> Result<T>
pub async fn beating<T>(&self, fut: impl Future<Output = T>) -> Result<T>
Run fut while renewing this lease every TURN_BEAT. A transient
beat failure is logged and the turn goes on; a lost lease drops fut
(the turn stops) and is an error, since somebody else may now be
running the same conversation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TurnLease
impl RefUnwindSafe for TurnLease
impl Send for TurnLease
impl Sync for TurnLease
impl Unpin for TurnLease
impl UnsafeUnpin for TurnLease
impl UnwindSafe for TurnLease
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
Converts
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> ⓘ
Converts
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