pub trait ConcurrentProgressLog:
ProgressLog
+ Sync
+ Send
+ Clone {
type Duplicated: ConcurrentProgressLog;
// Required method
fn dup(&self) -> Self::Duplicated;
}
Expand description
Concurrent logging trait.
This trait extends ProgressLog
by adding a
dup
method that duplicates the logger and
adding the Clone
, Sync
, and Send
traits.
By contract, Clone
implementations must return a new logger updating the
same internal state, so you can easily use a ConcurrentProgressLog
in
methods like
rayon::ParallelIterator::for_each_with
,
rayon::ParallelIterator::map_with
,
and so on. In a rayon
environment, however, you
cannot use display_memory
if another crate
in your compilation unit depends on on
sysinfo
’s (default) multithread
feature, as this can lead to a
deadlock .
Note that ProgressLogger
’s Clone
implementation has a
completely different semantics.
As explained in the crate documentation, we suggest using &mut Self::Concurrent
to pass a concurrent logger as an argument, to be able to
use optional logging.
§Examples
See the ConcurrentWrapper
documentation. type Concurrent =
Option<P::Concurrent>;
Required Associated Types§
Sourcetype Duplicated: ConcurrentProgressLog
type Duplicated: ConcurrentProgressLog
The type returned by dup
.
Required Methods§
Sourcefn dup(&self) -> Self::Duplicated
fn dup(&self) -> Self::Duplicated
Duplicate the concurrent progress logger, obtaning a new one.
Note that the this method has the same sematics of ProgressLogger
’s
Clone
implementation,
but in a ConcurrentProgressLog
by contract cloning must generate
copies with the same underlying logger.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.