pub struct SimpleControl { /* private fields */ }Expand description
A control line for programs without their own.
use net_io::{ControlLine, ControlState, SimpleControl};
let line = SimpleControl::new();
let before = line.epoch();
line.set(ControlState::Lockdown, None);
assert!(line.epoch() > before);
assert_eq!(line.state(), ControlState::Lockdown);Implementations§
Source§impl SimpleControl
impl SimpleControl
Sourcepub fn new() -> SimpleControl
pub fn new() -> SimpleControl
A line in Normal.
Sourcepub fn set(&self, state: ControlState, deadline: Option<Instant>)
pub fn set(&self, state: ControlState, deadline: Option<Instant>)
Changes the state and bumps the epoch.
Trait Implementations§
Source§impl ControlLine for SimpleControl
impl ControlLine for SimpleControl
Source§impl Debug for SimpleControl
impl Debug for SimpleControl
Auto Trait Implementations§
impl !Freeze for SimpleControl
impl RefUnwindSafe for SimpleControl
impl Send for SimpleControl
impl Sync for SimpleControl
impl Unpin for SimpleControl
impl UnsafeUnpin for SimpleControl
impl UnwindSafe for SimpleControl
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