pub struct Bomb<T> { /* private fields */ }
Expand description
A one-time use bomb.
The Fuse<T>
for this Bomb
can be lit only once,
and the bomb will remain in an exploded state for the
remainder of the existence of this instance.
Bomb
s can be safely cloned and sent between threads.
Implementations§
source§impl<T> Bomb<T>
impl<T> Bomb<T>
sourcepub fn new() -> (Fuse<T>, Bomb<T>)
pub fn new() -> (Fuse<T>, Bomb<T>)
Creates a new single producer Fuse<T>
, and a multi-consumer Bomb<T>
.
Instances of Bomb<T>
may be safely cloned and sent between threads.
sourcepub fn exploded(&self) -> Option<&T>
pub fn exploded(&self) -> Option<&T>
Returns Some
if the Bomb
has exploded.
Once the Bomb
has exploded, it will remain
in an exploded state for the remainder of the
existence of this Bomb
instance.
It is expected that the Bomb
is dropped after explosion,
to notify the original Fuse
(now Flame
) that this Bomb
has completed processing the data.