pub struct OrStop<A, B> { /* private fields */ }Expand description
Combines two Stop implementations.
The combined stop will trigger when either source stops.
§Example
use almost_enough::{StopSource, OrStop, Stop};
let timeout_source = StopSource::new();
let cancel_source = StopSource::new();
let combined = OrStop::new(timeout_source.as_ref(), cancel_source.as_ref());
// Not stopped yet
assert!(!combined.should_stop());
// Either source can trigger stop
cancel_source.cancel();
assert!(combined.should_stop());Implementations§
Trait Implementations§
impl<A: Copy, B: Copy> Copy for OrStop<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for OrStop<A, B>
impl<A, B> RefUnwindSafe for OrStop<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for OrStop<A, B>
impl<A, B> Sync for OrStop<A, B>
impl<A, B> Unpin for OrStop<A, B>
impl<A, B> UnwindSafe for OrStop<A, B>where
A: UnwindSafe,
B: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> StopExt for Twhere
T: Stop,
impl<T> StopExt for Twhere
T: Stop,
Source§impl<T> TimeoutExt for Twhere
T: Stop,
impl<T> TimeoutExt for Twhere
T: Stop,
Source§fn with_timeout(self, duration: Duration) -> WithTimeout<Self>
fn with_timeout(self, duration: Duration) -> WithTimeout<Self>
Add a timeout to this stop. Read more
Source§fn with_deadline(self, deadline: Instant) -> WithTimeout<Self>
fn with_deadline(self, deadline: Instant) -> WithTimeout<Self>
Add an absolute deadline to this stop. Read more