Struct stakker::sync::PipedLink

source ·
pub struct PipedLink<O: Send + Sync + 'static, I: Send + Sync + 'static> { /* private fields */ }
Expand description

Link from a PipedThread thread back to the main thread

Implementations§

source§

impl<O: Send + Sync + 'static, I: Send + Sync + 'static> PipedLink<O, I>

source

pub fn send(&mut self, msg: I) -> bool

Send a message back to the main thread. Returns true on success. If false is returned, then the PipedThread has been dropped and this thread should terminate itself.

source

pub fn recv(&mut self) -> Option<O>

Receive a message from the main thread. Blocks if there is no message already waiting. Returns None if the PipedThread has been dropped, in which case this thread should terminate itself.

source

pub fn cancel(&mut self) -> bool

Check whether cancellation has been flagged by the main thread. When the PipedThread is dropped, the cancel flag is set to tell this thread to terminate. If the thread is doing a long-running operation or blocking, it should check the cancel flag from time to time to recognise this condition and to clean up in good time.

Auto Trait Implementations§

§

impl<O, I> !RefUnwindSafe for PipedLink<O, I>

§

impl<O, I> Send for PipedLink<O, I>

§

impl<O, I> Sync for PipedLink<O, I>

§

impl<O, I> Unpin for PipedLink<O, I>

§

impl<O, I> !UnwindSafe for PipedLink<O, I>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.