pub struct CtrlcBuilder { /* private fields */ }Available on crate feature
print only.Expand description
Builder for a new frame for handling Ctrl-C signals.
The canonical factory function for this is cu::cli::ctrlc_frame.
See Handling Ctrl-C.
Implementations§
Source§impl CtrlcBuilder
impl CtrlcBuilder
Sourcepub fn abort_threshold(self, threshold: u8) -> Self
pub fn abort_threshold(self, threshold: u8) -> Self
Set the number of Ctrl-C signals required for the task
to be considered aborted (where the return will be Ok(None).
Default is 1
Sourcepub fn on_signal<F: Fn(CtrlcSignal) + Send + 'static>(self, f: F) -> Self
pub fn on_signal<F: Fn(CtrlcSignal) + Send + 'static>(self, f: F) -> Self
Set a function to be called when Ctrl-C signal is received.
The function will be executed on the Ctrl-C signal handling thread,
not the thread that runs the task, and is
pub async fn co_execute<T, TFuture, F>(self, f: F) -> Result<Option<T>>
Available on crate feature
coroutine only.Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CtrlcBuilder
impl !Sync for CtrlcBuilder
impl !UnwindSafe for CtrlcBuilder
impl Freeze for CtrlcBuilder
impl Send for CtrlcBuilder
impl Unpin for CtrlcBuilder
impl UnsafeUnpin for CtrlcBuilder
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