pub struct Channel<R, W> { /* private fields */ }Implementations§
Source§impl<R: PartialEq, W: PartialEq> Channel<R, W>
impl<R: PartialEq, W: PartialEq> Channel<R, W>
Sourcepub fn wait_for_or_timeout(
&self,
waited_message: R,
timeout: Duration,
) -> Result<(), RecvTimeoutError>
pub fn wait_for_or_timeout( &self, waited_message: R, timeout: Duration, ) -> Result<(), RecvTimeoutError>
Waits for a specific message of type R to be received or times out after a specified duration.
§Parameters
waited_message: The message to wait for.timeout: The duration to wait before timing out.
§Returns
Ok(())if the waited message is received before the timeout.- An error of type
std::sync::mpsc::RecvTimeoutError::Timeoutif the timeout occurs. - An error of type
std::sync::mpsc::RecvTimeoutErrorif the receiving fails.
Sourcepub fn send(&self, t: W) -> Result<(), SendError<W>>
pub fn send(&self, t: W) -> Result<(), SendError<W>>
Short hand for std::sync::mpsc::Sender::send
Sourcepub fn iter(&self) -> Iter<'_, R>
pub fn iter(&self) -> Iter<'_, R>
Short hand for std::sync::mpsc::Receiver::iter
Sourcepub fn try_iter(&self) -> TryIter<'_, R>
pub fn try_iter(&self) -> TryIter<'_, R>
Short hand for std::sync::mpsc::Receiver::try_iter
Sourcepub fn recv(&self) -> Result<R, RecvError>
pub fn recv(&self) -> Result<R, RecvError>
Short hand for std::sync::mpsc::Receiver::recv
Sourcepub fn try_recv(&self) -> Result<R, TryRecvError>
pub fn try_recv(&self) -> Result<R, TryRecvError>
Short hand for std::sync::mpsc::Receiver::try_recv
Sourcepub fn recv_timeout(&self, timeout: Duration) -> Result<R, RecvTimeoutError>
pub fn recv_timeout(&self, timeout: Duration) -> Result<R, RecvTimeoutError>
Short hand for std::sync::mpsc::Receiver::recv_timeout
Auto Trait Implementations§
impl<R, W> Freeze for Channel<R, W>
impl<R, W> RefUnwindSafe for Channel<R, W>
impl<R, W> Send for Channel<R, W>
impl<R, W> !Sync for Channel<R, W>
impl<R, W> Unpin for Channel<R, W>
impl<R, W> UnwindSafe for Channel<R, W>
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