pub struct RunControl {
pub cancel: Arc<AtomicBool>,
pub progress: Arc<Progress>,
pub threads: Option<NonZeroUsize>,
pub batch_limits: BatchLimits,
pub expected_probe: Option<ProbeFacts>,
pub thread_start: Option<Hook>,
pub threads_ready: Option<Hook>,
}Expand description
Cancellation, progress and threading for one analysis.
Fields§
§cancel: Arc<AtomicBool>Set to request cancellation; the analysis returns DimaError::Cancelled promptly.
progress: Arc<Progress>Progress counters.
threads: Option<NonZeroUsize>Worker threads; None uses the available parallelism.
batch_limits: BatchLimitsBatch limits of the reader (defaults per D40; smaller values only change memory use and are used by tests to exercise batch boundaries — results never depend on them).
expected_probe: Option<ProbeFacts>What a pre-check saw in the input’s first batch (D108). When set, the run stops with
DimaError::InputChanged before counting if its own first batch differs, so a file
replaced after it was checked is never analysed with settings chosen for another one.
It never changes results.
thread_start: Option<Hook>Runs first in every thread the analysis starts (reader, checksum, workers). The desktop app lowers their priority there: on Windows threads do not inherit it (D101).
threads_ready: Option<Hook>Runs once every thread the analysis needs is running, before counting. The command line starts its progress display there, so an optional thread never takes the place of one the run needs when the system limits threads (D110).
Implementations§
Source§impl RunControl
impl RunControl
Sourcepub fn with_threads(self, threads: NonZeroUsize) -> Self
pub fn with_threads(self, threads: NonZeroUsize) -> Self
Sets the number of worker threads.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
true once cancellation was requested.
Sourcepub fn thread_count(&self) -> NonZeroUsize
pub fn thread_count(&self) -> NonZeroUsize
The worker-thread count: the explicit value, else the available parallelism (≥ 1).
Trait Implementations§
Source§impl Clone for RunControl
impl Clone for RunControl
Source§fn clone(&self) -> RunControl
fn clone(&self) -> RunControl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RunControl
impl Debug for RunControl
Source§impl Default for RunControl
impl Default for RunControl
Source§fn default() -> RunControl
fn default() -> RunControl
Auto Trait Implementations§
impl !RefUnwindSafe for RunControl
impl !UnwindSafe for RunControl
impl Freeze for RunControl
impl Send for RunControl
impl Sync for RunControl
impl Unpin for RunControl
impl UnsafeUnpin for RunControl
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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