Struct MockTransport
pub struct MockTransport { /* private fields */ }Expand description
Implementations§
§impl MockTransport
impl MockTransport
pub fn new() -> MockTransport
pub fn new() -> MockTransport
Create a new, disconnected mock transport.
pub fn script_recv(&mut self, data: Vec<u8>)
pub fn script_recv(&mut self, data: Vec<u8>)
Queue a message to be returned by Transport::recv.
pub fn script_close_reason(&mut self, reason: impl Into<String>)
pub fn script_close_reason(&mut self, reason: impl Into<String>)
Script the reason the peer gives for closing, so a test can assert that it reaches the application rather than being swallowed.
Trait Implementations§
§impl Default for MockTransport
impl Default for MockTransport
§fn default() -> MockTransport
fn default() -> MockTransport
Returns the “default value” for a type. Read more
§impl Transport for MockTransport
impl Transport for MockTransport
§fn connect<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_url: &'life1 str,
_headers: Vec<(String, String)>,
) -> Pin<Box<dyn Future<Output = Result<(), <MockTransport as Transport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MockTransport: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_url: &'life1 str,
_headers: Vec<(String, String)>,
) -> Pin<Box<dyn Future<Output = Result<(), <MockTransport as Transport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MockTransport: 'async_trait,
Connect to the given URL with optional headers.
§fn send<'life0, 'async_trait>(
&'life0 mut self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), <MockTransport as Transport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
MockTransport: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 mut self,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), <MockTransport as Transport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
MockTransport: 'async_trait,
Send raw bytes.
§fn recv<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, <MockTransport as Transport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
MockTransport: 'async_trait,
fn recv<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, <MockTransport as Transport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
MockTransport: 'async_trait,
Receive raw bytes. Returns
None when the connection is closed.§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), <MockTransport as Transport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
MockTransport: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), <MockTransport as Transport>::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
MockTransport: 'async_trait,
Close the transport.
§fn close_reason(&self) -> Option<String>
fn close_reason(&self) -> Option<String>
Why the peer closed the connection, if it said. Read more
Auto Trait Implementations§
impl Freeze for MockTransport
impl RefUnwindSafe for MockTransport
impl Send for MockTransport
impl Sync for MockTransport
impl Unpin for MockTransport
impl UnwindSafe for MockTransport
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