pub struct CancelGroup { /* private fields */ }Expand description
OR-combinator for cancellation tokens.
Fires when any source token is cancelled. No spawn — uses
sync polling for is_cancelled() and select_all for the
async cancelled() future.
Supports composition via |:
ⓘ
let cancel = token_a | token_b;
let cancel = group | extra_token;
let cancel = group1 | group2;Implementations§
Source§impl CancelGroup
impl CancelGroup
pub fn new(sources: Vec<CancellationToken>) -> Self
pub async fn cancelled(&self)
Sourcepub fn equals_ptr(&self, other: &Self) -> bool
pub fn equals_ptr(&self, other: &Self) -> bool
Returns true if both groups share the same underlying source array.
pub fn is_cancelled(&self) -> bool
Trait Implementations§
Source§impl BitOr<CancelGroup> for CancellationToken
impl BitOr<CancelGroup> for CancellationToken
Source§type Output = CancelGroup
type Output = CancelGroup
The resulting type after applying the
| operator.Source§fn bitor(self, rhs: CancelGroup) -> CancelGroup
fn bitor(self, rhs: CancelGroup) -> CancelGroup
Performs the
| operation. Read moreSource§impl BitOr<CancellationToken> for CancelGroup
impl BitOr<CancellationToken> for CancelGroup
Source§type Output = CancelGroup
type Output = CancelGroup
The resulting type after applying the
| operator.Source§fn bitor(self, rhs: CancellationToken) -> Self
fn bitor(self, rhs: CancellationToken) -> Self
Performs the
| operation. Read moreSource§impl BitOr for CancelGroup
impl BitOr for CancelGroup
Source§impl Clone for CancelGroup
impl Clone for CancelGroup
Source§fn clone(&self) -> CancelGroup
fn clone(&self) -> CancelGroup
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl From<CancellationToken> for CancelGroup
impl From<CancellationToken> for CancelGroup
Source§fn from(token: CancellationToken) -> Self
fn from(token: CancellationToken) -> Self
Converts to this type from the input type.
Source§impl From<Vec<CancellationToken>> for CancelGroup
impl From<Vec<CancellationToken>> for CancelGroup
Source§fn from(tokens: Vec<CancellationToken>) -> Self
fn from(tokens: Vec<CancellationToken>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for CancelGroup
impl RefUnwindSafe for CancelGroup
impl Send for CancelGroup
impl Sync for CancelGroup
impl Unpin for CancelGroup
impl UnsafeUnpin for CancelGroup
impl UnwindSafe for CancelGroup
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