pub struct FakeTransport { /* private fields */ }Expand description
A transport whose connections a test accepts and plays the server on.
Implementations§
Source§impl FakeTransport
impl FakeTransport
Sourcepub fn new() -> FakeTransport
pub fn new() -> FakeTransport
A transport that answers every dial with a connection speaking
actioncable-v1-json.
Sourcepub fn speak(&self, subprotocol: Option<&str>)
pub fn speak(&self, subprotocol: Option<&str>)
What the fake server names as the negotiated subprotocol from now on.
Sourcepub fn write_buffer(&self, commands: usize)
pub fn write_buffer(&self, commands: usize)
How many commands a connection takes before a write waits on the test to read them. One, the smallest a channel can be, is how a test holds the client mid-write.
Sourcepub fn fail_next_dial(&self, reason: &str)
pub fn fail_next_dial(&self, reason: &str)
Turns the next dial down, as a refused connection would.
Sourcepub fn dialed_with(&self) -> DialOptions
pub fn dialed_with(&self) -> DialOptions
The options the client last dialed with.
Sourcepub async fn accept(&self) -> Arc<FakeConn> ⓘ
pub async fn accept(&self) -> Arc<FakeConn> ⓘ
The next connection the client opened, to play the server on.
Sourcepub async fn refuse_dial(&self)
pub async fn refuse_dial(&self)
Fails when the client dials at all in the next little while.
Trait Implementations§
Source§impl Clone for FakeTransport
impl Clone for FakeTransport
Source§impl Default for FakeTransport
impl Default for FakeTransport
Source§fn default() -> FakeTransport
fn default() -> FakeTransport
Returns the “default value” for a type. Read more
Source§impl Transport for FakeTransport
impl Transport for FakeTransport
Source§fn dial<'life0, 'life1, 'async_trait>(
&'life0 self,
_url: &'life1 str,
options: DialOptions,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Conn>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn dial<'life0, 'life1, 'async_trait>(
&'life0 self,
_url: &'life1 str,
options: DialOptions,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Conn>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Opens one connection.
options carries the subprotocols the client’s protocols
negotiate under and the headers that authorize the request.Auto Trait Implementations§
impl !RefUnwindSafe for FakeTransport
impl !UnwindSafe for FakeTransport
impl Freeze for FakeTransport
impl Send for FakeTransport
impl Sync for FakeTransport
impl Unpin for FakeTransport
impl UnsafeUnpin for FakeTransport
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