pub struct ScanEvents { /* private fields */ }Expand description
The live event stream of a scan.
Each event says that something changed; the detail is read back from the
HostStore. See ScanEvent.
The stream holds CAPACITY events, and a scan that fills
it overwrites the oldest. A caller who never reads it costs the scan one
fixed buffer, and a slow reader never holds the scan up.
The read after a gap answers ScanEvent::EventsDropped with how many
events went missing.
A gap loses notices, not findings. A dropped
HostUpdated named a host whose current state is
in the HostStore, so after a gap, re-read the store. A dropped
ScannerFailed still reaches the
ScanReport, which carries every failure.
Implementations§
Source§impl ScanEvents
impl ScanEvents
Sourcepub const CAPACITY: usize = 1024
pub const CAPACITY: usize = 1024
How many events the stream holds for a consumer that has not caught up.
The buffer is allocated when the scan starts.
Sourcepub async fn recv(&mut self) -> Option<ScanEvent>
pub async fn recv(&mut self) -> Option<ScanEvent>
Waits for the next event. None once the scan has ended and every event
it emitted has been taken.
Falling behind arrives as ScanEvent::EventsDropped, in the position
the missing events would have had, and the stream carries on with the
oldest event it still holds.
Sourcepub fn try_recv(&mut self) -> Option<ScanEvent>
pub fn try_recv(&mut self) -> Option<ScanEvent>
The next event if one is already queued, without waiting.
None covers both “nothing queued right now” and “the scan is over”, so
it drains a finished scan but cannot detect the end of a running one. Use
recv for that. A gap reads the same way it does through
recv, as ScanEvent::EventsDropped.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ScanEvents
impl !UnwindSafe for ScanEvents
impl Freeze for ScanEvents
impl Send for ScanEvents
impl Sync for ScanEvents
impl Unpin for ScanEvents
impl UnsafeUnpin for ScanEvents
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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> ⓘ
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