pub struct CancelFlag<'a> { /* private fields */ }Expand description
Cheap cooperative cancel handle for long-running I/O.
None means never cancel (the common default). Some borrows an
AtomicCancel owned by the CLI interrupt handler, UI, or embedder.
This is intentionally non-generic: every transfer path already needs a
single type-erased shape for service structs (FetchServices, etc.).
Implementations§
Source§impl CancelFlag<'static>
impl CancelFlag<'static>
Source§impl<'a> CancelFlag<'a>
impl<'a> CancelFlag<'a>
Sourcepub const fn new(source: &'a AtomicCancel) -> Self
pub const fn new(source: &'a AtomicCancel) -> Self
Wrap a shared atomic cancel source.
Sourcepub const fn never_dyn() -> CancelFlag<'static>
pub const fn never_dyn() -> CancelFlag<'static>
Alias for CancelFlag::never used by older call sites.
Sourcepub fn is_cancelled(self) -> bool
pub fn is_cancelled(self) -> bool
Whether cancellation has been requested.
Sourcepub fn check(self) -> Result<()>
pub fn check(self) -> Result<()>
Return GitError::Cancelled when the flag is set; otherwise Ok(()).
Sourcepub fn control(self) -> StreamControl
pub fn control(self) -> StreamControl
Map the flag into a StreamControl value for emit-style loops.
Sourcepub fn as_ref(self) -> CancelFlag<'a>
pub fn as_ref(self) -> CancelFlag<'a>
Borrowed view with a possibly shorter lifetime (no-op for Copy).
Sourcepub fn source(self) -> Option<&'a AtomicCancel>
pub fn source(self) -> Option<&'a AtomicCancel>
Underlying atomic, if any.
Trait Implementations§
Source§impl<'a> Clone for CancelFlag<'a>
impl<'a> Clone for CancelFlag<'a>
Source§fn clone(&self) -> CancelFlag<'a>
fn clone(&self) -> CancelFlag<'a>
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 moreimpl<'a> Copy for CancelFlag<'a>
Source§impl<'a> Debug for CancelFlag<'a>
impl<'a> Debug for CancelFlag<'a>
Source§impl<'a> Default for CancelFlag<'a>
impl<'a> Default for CancelFlag<'a>
Source§fn default() -> CancelFlag<'a>
fn default() -> CancelFlag<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for CancelFlag<'a>
impl<'a> RefUnwindSafe for CancelFlag<'a>
impl<'a> Send for CancelFlag<'a>
impl<'a> Sync for CancelFlag<'a>
impl<'a> Unpin for CancelFlag<'a>
impl<'a> UnsafeUnpin for CancelFlag<'a>
impl<'a> UnwindSafe for CancelFlag<'a>
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