pub struct WriteOutcomeTracker(AtomicU8);Expand description
Tracks, for a single tracked outbound write, whether retrying after a
non-success outcome risks sending the same frame twice. A plain
success/failure Result isn’t enough for this: once a frame is handed
to run_writer it will be delivered independent of anything that
happens afterward to the caller’s future, including that future being
dropped/cancelled before it ever observes an outcome — a case a Result
alone can’t represent, but which a caller’s own Drop glue can still
consult here (ReAgent P1, PR #3212 6th review).
Tuple Fields§
§0: AtomicU8Implementations§
Source§impl WriteOutcomeTracker
impl WriteOutcomeTracker
const NOT_QUEUED: u8 = 0
const OUTCOME_UNCONFIRMED: u8 = 1
const CONFIRMED_UNDELIVERED: u8 = 2
pub fn new() -> Self
fn mark_queued(&self)
fn mark_confirmed_undelivered(&self)
Sourcepub fn safe_to_retry(&self) -> bool
pub fn safe_to_retry(&self) -> bool
True if the frame was never queued, or was queued and its delivery is now confirmed to have failed — in both cases nothing was, or ever will be, delivered, so sending again cannot produce a duplicate. False once queued but unconfirmed, which also covers a confirmed success (obviously never safe to retry either).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WriteOutcomeTracker
impl RefUnwindSafe for WriteOutcomeTracker
impl Send for WriteOutcomeTracker
impl Sync for WriteOutcomeTracker
impl Unpin for WriteOutcomeTracker
impl UnsafeUnpin for WriteOutcomeTracker
impl UnwindSafe for WriteOutcomeTracker
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