pub struct StopRecord { /* private fields */ }Expand description
Immutable provenance for the first accepted STOP request.
Implementations§
Source§impl StopRecord
impl StopRecord
Sourcepub fn actor(&self) -> &str
pub fn actor(&self) -> &str
The party or subsystem that requested STOP.
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 reason(&self) -> &str
pub fn reason(&self) -> &str
The reason supplied with the STOP request.
Examples found in repository?
examples/worker.rs (line 14)
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}Trait Implementations§
Source§impl Clone for StopRecord
impl Clone for StopRecord
Source§impl Debug for StopRecord
impl Debug for StopRecord
impl Eq for StopRecord
Source§impl Hash for StopRecord
impl Hash for StopRecord
Source§impl PartialEq for StopRecord
impl PartialEq for StopRecord
impl StructuralPartialEq for StopRecord
Auto Trait Implementations§
impl Freeze for StopRecord
impl RefUnwindSafe for StopRecord
impl Send for StopRecord
impl Sync for StopRecord
impl Unpin for StopRecord
impl UnsafeUnpin for StopRecord
impl UnwindSafe for StopRecord
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