pub struct Remote { /* private fields */ }
Expand description
A remote that allows for pausing, stopping, and resuming the Halt
wrapper from another thread.
Examples
let halt = halt::new(0..10);
let remote = halt.remote();
Implementations
sourceimpl Remote
impl Remote
sourcepub fn resume(&self) -> bool
pub fn resume(&self) -> bool
Resumes the Halt
, causing it to run as normal.
Returns true
if the remote is_valid
.
sourcepub fn pause(&self) -> bool
pub fn pause(&self) -> bool
Pauses the Halt
, causing the thread that runs it to sleep until resumed or stopped.
Returns true
if the remote is_valid
.
sourcepub fn stop(&self) -> bool
pub fn stop(&self) -> bool
Stops the Halt
, causing it to behave as done until resumed or paused.
When Halt
is used as an iterator, the iterator will return None
.
When used as a reader or writer, it will return Ok(0)
.
Returns true
if the remote is_valid
.
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true
if the remote is valid, i.e. the Halt
has not been dropped.
sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Returns true
if running.
sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Returns true
if stopped.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Remote
impl Send for Remote
impl Sync for Remote
impl Unpin for Remote
impl !UnwindSafe for Remote
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more