pub struct InmemoryTransport { /* private fields */ }
Expand description
Represents a Transport
comprised of two inmemory channels
Implementations§
Source§impl InmemoryTransport
impl InmemoryTransport
Sourcepub fn pair(buffer: usize) -> (Self, Self)
pub fn pair(buffer: usize) -> (Self, Self)
Returns pair of transports that are connected such that one sends to the other and vice versa
Sourcepub fn link(&mut self, other: &mut InmemoryTransport, buffer: usize)
pub fn link(&mut self, other: &mut InmemoryTransport, buffer: usize)
Links two independent InmemoryTransport
together by dropping their internal channels
and generating new ones of buffer
capacity to connect these transports.
§Note
This will drop any pre-existing data in the internal storage to avoid corruption.
Trait Implementations§
Source§impl Debug for InmemoryTransport
impl Debug for InmemoryTransport
Source§impl Reconnectable for InmemoryTransport
impl Reconnectable for InmemoryTransport
Source§fn reconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn reconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Once the underlying channels have closed, there is no way for this transport to
re-establish those channels; therefore, reconnecting will fail with
ErrorKind::ConnectionRefused
if either underlying channel has closed.
Source§impl Transport for InmemoryTransport
impl Transport for InmemoryTransport
Source§fn try_read(&self, buf: &mut [u8]) -> Result<usize>
fn try_read(&self, buf: &mut [u8]) -> Result<usize>
Tries to read data from the transport into the provided buffer, returning how many bytes
were read. Read more
Auto Trait Implementations§
impl !Freeze for InmemoryTransport
impl RefUnwindSafe for InmemoryTransport
impl Send for InmemoryTransport
impl Sync for InmemoryTransport
impl Unpin for InmemoryTransport
impl UnwindSafe for InmemoryTransport
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> TransportExt for Twhere
T: Transport,
impl<T> TransportExt for Twhere
T: Transport,
Source§fn readable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn readable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Waits for the transport to be readable to follow up with
try_read
.Source§fn writeable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn writeable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Waits for the transport to be writeable to follow up with
try_write
.Source§fn readable_or_writeable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
fn readable_or_writeable<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
T: 'async_trait,
Waits for the transport to be either readable or writeable.
Source§fn read_exact<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn read_exact<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut [u8],
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Source§fn read_to_end<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn read_to_end<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Reads all bytes until EOF in this source, placing them into
buf
. Read moreSource§fn read_to_string<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut String,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn read_to_string<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut String,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Reads all bytes until EOF in this source, placing them into
buf
. Read moreSource§fn write_all<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
fn write_all<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
Writes all of
buf
by continuing to call try_write
until completed. Calls to
[writeable
] are made to ensure the transport is ready.