Skip to main content

BatchRecord

Struct BatchRecord 

Source
pub struct BatchRecord {
    signature: String,
    rescued: bool,
}
Expand description

Names the batch LoopDetector::check just counted.

LoopDetector::record_results takes one so it cannot be handed the wrong batch. The answers it records belong to the batch that just ran, and the comparison at the next check is against those; passing the previous batch’s instead would invert the measurement silently, which is a mistake this codebase has made once already with a global id map and caught only in review. Consumed by record_results and deliberately not Clone: recording one batch twice would let a second, different answer rescue a run that never changed its answer, and no call site has a reason to do it. The type is what stops that rather than a rule in prose.

Fields§

§signature: String§rescued: bool

Implementations§

Source§

impl BatchRecord

Source

pub const fn rescued(&self) -> bool

Whether this occurrence survived only because an earlier answer moved.

True when the run has repeated more times than the threshold allows and LoopDetector::check passed anyway — which is exactly the turn that signature-only counting would have refused. Known when the verdict is reached, not when the next answers arrive: the reset that saved this turn happened on a previous one.

Trait Implementations§

Source§

impl Debug for BatchRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more