pub struct ScanTask { /* private fields */ }Expand description
A handle to a running scan.
Discovered hosts arrive live through the paired ScanSession. Await this
handle, or call ScanTask::join, to wait for the whole scan to finish and
receive the ScanReport describing it. To stop a scan early, call
ScanHandle::abort on the
session’s handle; the report still arrives, describing however far the scan
got.
A scan given
ZondConfig::scan_timeout stops
itself the same way when its budget runs out.
§Dropping it stops the scan
This is the scan’s owner and the only way to its report. Dropped before the
scan has finished, or while being awaited, it stops the scan as
abort would; otherwise a
listener scan would keep its sockets, captures and probes going forever. The
scan winds down through the usual checks, so a journal it writes gets its last
checkpoint and keeps its lock until then, and no resume can take the job while
this one is still probing. That last write needs the scan’s runtime: a task
dropped after the runtime has shut down leaves the journal at its last timed
checkpoint.
Dropping the ScanSession stops nothing, so a caller that wants only the
report may let it go and await this.
Implementations§
Source§impl ScanTask
impl ScanTask
Sourcepub async fn join(self) -> Result<ScanReport, ScanError>
pub async fn join(self) -> Result<ScanReport, ScanError>
Waits for the scan to finish and returns its report.
An error here means the scan never ran to completion. A strategy that
failed part way through is recorded in the report’s
failures and announced on the ScanSession
event stream, and the report keeps what the other strategies found.
Dropped while it waits, the scan is stopped; see the type.
Trait Implementations§
Source§impl IntoFuture for ScanTask
impl IntoFuture for ScanTask
Source§type Output = Result<ScanReport, ScanError>
type Output = Result<ScanReport, ScanError>
Source§type IntoFuture = Pin<Box<dyn Future<Output = <ScanTask as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <ScanTask as IntoFuture>::Output> + Send>>
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Auto Trait Implementations§
impl !RefUnwindSafe for ScanTask
impl !UnwindSafe for ScanTask
impl Freeze for ScanTask
impl Send for ScanTask
impl Sync for ScanTask
impl Unpin for ScanTask
impl UnsafeUnpin for ScanTask
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