pub struct Stopped { /* private fields */ }Expand description
Error returned when a checkpoint observes STOP.
Implementations§
Source§impl Stopped
impl Stopped
Sourcepub fn record(&self) -> &StopRecord
pub fn record(&self) -> &StopRecord
Returns the canonical first STOP record.
Examples found in repository?
examples/worker.rs (line 13)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let signal = CocoshigaStop::new();
5 let worker = signal.clone();
6
7 signal.request_stop("operator", "maintenance window")?;
8
9 match worker.checkpoint() {
10 Ok(()) => println!("worker continues"),
11 Err(stopped) => println!(
12 "worker stopped by {}: {}",
13 stopped.record().actor(),
14 stopped.record().reason()
15 ),
16 }
17
18 Ok(())
19}Sourcepub fn into_record(self) -> StopRecord
pub fn into_record(self) -> StopRecord
Consumes the error and returns its STOP record.
Trait Implementations§
impl Eq for Stopped
Source§impl Error for Stopped
impl Error for Stopped
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
impl StructuralPartialEq for Stopped
Auto Trait Implementations§
impl Freeze for Stopped
impl RefUnwindSafe for Stopped
impl Send for Stopped
impl Sync for Stopped
impl Unpin for Stopped
impl UnsafeUnpin for Stopped
impl UnwindSafe for Stopped
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