pub struct NodeControl { /* private fields */ }Expand description
Bounds a serving loop: a step budget, plus a stop flag another thread can raise.
A mobile node needs both. An Android service or an iOS app gets backgrounded, thermally throttled, or unplugged, and must leave the mesh without waiting for the coordinator to finish the job.
The flag is observed between activations, not during one. A node parked
in recv stays parked until its peer sends or the link drops — stopping is
cooperative, not a cancellation.
Implementations§
Source§impl NodeControl
impl NodeControl
Sourcepub fn unbounded() -> Self
pub fn unbounded() -> Self
Serve until the coordinator finishes or NodeStopHandle::stop fires.
Sourcepub fn stop_handle(&self) -> NodeStopHandle
pub fn stop_handle(&self) -> NodeStopHandle
A handle another thread can use to wind this node down.
Sourcepub fn should_continue(&self, done: usize) -> bool
pub fn should_continue(&self, done: usize) -> bool
Whether the loop should run another activation.
Trait Implementations§
Source§impl Clone for NodeControl
impl Clone for NodeControl
Auto Trait Implementations§
impl Freeze for NodeControl
impl RefUnwindSafe for NodeControl
impl Send for NodeControl
impl Sync for NodeControl
impl Unpin for NodeControl
impl UnsafeUnpin for NodeControl
impl UnwindSafe for NodeControl
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more