pub struct LocalChannel { /* private fields */ }Expand description
In-memory channel for testing. One end of a LocalChannelPair.
Messages sent on this channel appear in the receive queue of the paired channel, and vice versa. This provides a simple loopback mechanism for unit testing protocol and data channel code without real sockets.
Trait Implementations§
Source§impl Channel for LocalChannel
impl Channel for LocalChannel
Source§fn receive(&self, timeout: Duration) -> Result<Option<Vec<u8>>>
fn receive(&self, timeout: Duration) -> Result<Option<Vec<u8>>>
Receive a message, blocking until data is available or the timeout
expires. Returns
Ok(None) on timeout with no data.Auto Trait Implementations§
impl !Freeze for LocalChannel
impl !RefUnwindSafe for LocalChannel
impl !UnwindSafe for LocalChannel
impl Send for LocalChannel
impl Sync for LocalChannel
impl Unpin for LocalChannel
impl UnsafeUnpin for LocalChannel
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> 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