pub struct TestTransport { /* private fields */ }Expand description
a readable and writable transport for testing
Implementations§
Source§impl TestTransport
impl TestTransport
Sourcepub fn write_side(&self) -> &CloseableCursor
pub fn write_side(&self) -> &CloseableCursor
Borrows the write side of this transport
Sourcepub fn set_peer_ip(&mut self, peer_ip: IpAddr) -> &mut Self
pub fn set_peer_ip(&mut self, peer_ip: IpAddr) -> &mut Self
Sets peer ip for the read side, returning &mut Self for chaining
Source§impl TestTransport
impl TestTransport
Sourcepub fn new() -> (TestTransport, TestTransport)
pub fn new() -> (TestTransport, TestTransport)
constructs a new test transport pair, representing two ends of a connection. either of them can be written to, and the content will be readable from the other. either of them can also be closed.
Sourcepub fn shutdown(&self, how: Shutdown)
pub fn shutdown(&self, how: Shutdown)
Shuts down the read, write, or both halves of this connection.
Sourcepub fn write_all(&self, bytes: impl AsRef<[u8]>)
pub fn write_all(&self, bytes: impl AsRef<[u8]>)
synchronously append the supplied bytes to the write side of this transport, notifying the read side of the other end
Sourcepub async fn read_available(&self) -> Vec<u8> ⓘ
pub async fn read_available(&self) -> Vec<u8> ⓘ
waits until there is content and then reads that content to a vec until there is no further content immediately available
Sourcepub async fn read_available_string(&self) -> String
pub async fn read_available_string(&self) -> String
waits until there is content and then reads that content to a string until there is no further content immediately available
Trait Implementations§
Source§impl AsyncRead for TestTransportwhere
Self: Unpin,
impl AsyncRead for TestTransportwhere
Self: Unpin,
Source§impl AsyncWrite for TestTransportwhere
Self: Unpin,
impl AsyncWrite for TestTransportwhere
Self: Unpin,
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§impl Clone for TestTransport
impl Clone for TestTransport
Source§fn clone(&self) -> TestTransport
fn clone(&self) -> TestTransport
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TestTransport
impl Debug for TestTransport
Source§impl Default for TestTransport
impl Default for TestTransport
Source§fn default() -> TestTransport
fn default() -> TestTransport
Source§impl Drop for TestTransport
impl Drop for TestTransport
Source§impl Transport for TestTransport
impl Transport for TestTransport
Source§fn peer_addr(&self) -> Result<Option<SocketAddr>>
fn peer_addr(&self) -> Result<Option<SocketAddr>>
Source§fn set_linger(&mut self, linger: Option<Duration>) -> Result<(), Error>
fn set_linger(&mut self, linger: Option<Duration>) -> Result<(), Error>
SO_LINGER option Read moreAuto Trait Implementations§
impl Freeze for TestTransport
impl RefUnwindSafe for TestTransport
impl Send for TestTransport
impl Sync for TestTransport
impl Unpin for TestTransport
impl UnsafeUnpin for TestTransport
impl UnwindSafe for TestTransport
Blanket Implementations§
Source§impl<R> AsyncReadExt for R
impl<R> AsyncReadExt for R
Source§fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self>where
Self: Unpin,
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self>where
Self: Unpin,
Source§fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectoredFuture<'a, Self>where
Self: Unpin,
fn read_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>],
) -> ReadVectoredFuture<'a, Self>where
Self: Unpin,
Source§fn read_to_end<'a>(
&'a mut self,
buf: &'a mut Vec<u8>,
) -> ReadToEndFuture<'a, Self>where
Self: Unpin,
fn read_to_end<'a>(
&'a mut self,
buf: &'a mut Vec<u8>,
) -> ReadToEndFuture<'a, Self>where
Self: Unpin,
Source§fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToStringFuture<'a, Self>where
Self: Unpin,
fn read_to_string<'a>(
&'a mut self,
buf: &'a mut String,
) -> ReadToStringFuture<'a, Self>where
Self: Unpin,
Source§fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>where
Self: Unpin,
fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self>where
Self: Unpin,
buf. Read moreSource§fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
limit bytes from it. Read moreSource§impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
Source§fn write<'a>(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where
Self: Unpin,
fn write<'a>(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where
Self: Unpin,
Source§fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectoredFuture<'a, Self>where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectoredFuture<'a, Self>where
Self: Unpin,
Source§fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>where
Self: Unpin,
fn write_all<'a>(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self>where
Self: Unpin,
Source§fn flush(&mut self) -> FlushFuture<'_, Self>where
Self: Unpin,
fn flush(&mut self) -> FlushFuture<'_, Self>where
Self: Unpin,
Source§fn boxed_writer<'a>(self) -> Pin<Box<dyn AsyncWrite + Send + 'a>>
fn boxed_writer<'a>(self) -> Pin<Box<dyn AsyncWrite + Send + 'a>>
alloc only.dyn AsyncWrite + Send + 'a. Read more