pub struct MemoryTransport {
buffer: VecDeque<u8>,
}Expand description
An in-memory loopback transport, primarily for tests: bytes written with
PhysicalTransport::send are read back by PhysicalTransport::receive.
It implements crate::transport::NetworkTransport, so it can back either framing sub-layer.
Fields§
§buffer: VecDeque<u8>Implementations§
Trait Implementations§
Source§impl Debug for MemoryTransport
impl Debug for MemoryTransport
Source§impl Default for MemoryTransport
impl Default for MemoryTransport
Source§fn default() -> MemoryTransport
fn default() -> MemoryTransport
Returns the “default value” for a type. Read more
impl NetworkTransport for MemoryTransport
Source§impl PhysicalTransport for MemoryTransport
impl PhysicalTransport for MemoryTransport
Source§fn receive(&mut self, buf: &mut [u8]) -> Result<usize>
fn receive(&mut self, buf: &mut [u8]) -> Result<usize>
Receives bytes into
buf, returning the number of bytes read. A return
value of 0 indicates end of stream.Source§fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()>
fn set_read_timeout(&mut self, timeout: Option<Duration>) -> Result<()>
Sets the maximum time a subsequent
receive call may
block before returning an io::ErrorKind::TimedOut (or
io::ErrorKind::WouldBlock) error. None waits indefinitely (the
default behaviour, and what every receive implementation must do
when this method is never called). Read moreAuto Trait Implementations§
impl Freeze for MemoryTransport
impl RefUnwindSafe for MemoryTransport
impl Send for MemoryTransport
impl Sync for MemoryTransport
impl Unpin for MemoryTransport
impl UnsafeUnpin for MemoryTransport
impl UnwindSafe for MemoryTransport
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