Struct safeword::Safeword [−][src]
pub struct Safeword { /* fields omitted */ }
A modified Tokio runtime that exits early on a signal.
The Default
impl returns a Safeword
that exits on SIGINT (Ctrl-C) or SIGTERM (what init
systems normally use to terminate a process).
Methods
impl Safeword
[src]
impl Safeword
pub fn new() -> Safeword
[src]
pub fn new() -> Safeword
Create a Safeword
that has no configured signals.
pub fn signal(self, signal: c_int) -> Safeword
[src]
pub fn signal(self, signal: c_int) -> Safeword
Exit early on a Unix signal.
pub fn run<F>(self, future: F) -> Result<(), Shutdown<F::Item, F::Error>> where
F: Future + Send + 'static,
F::Item: Send,
F::Error: Send,
[src]
pub fn run<F>(self, future: F) -> Result<(), Shutdown<F::Item, F::Error>> where
F: Future + Send + 'static,
F::Item: Send,
F::Error: Send,
Run the given Future
.
Returns Ok(())
if the runtime was terminated by a configured signal. Returns Err
if
anything else happens, including the Future
exiting of its own volition, or if something
internal to Safeword fails.
Trait Implementations
impl Debug for Safeword
[src]
impl Debug for Safeword
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Safeword
[src]
impl Default for Safeword