pub struct WsBuilder { /* private fields */ }
Expand description
A Websocket builder for testing filters.
See module documentation for an overview.
Implementations§
Source§impl WsBuilder
impl WsBuilder
Sourcepub async fn handshake<F>(self, f: F) -> Result<WsClient, WsError>
pub async fn handshake<F>(self, f: F) -> Result<WsClient, WsError>
Execute this Websocket request against the provided filter.
If the handshake succeeds, returns a WsClient
.
§Example
use futures_util::future;
use warp::Filter;
#[tokio::main]
// Some route that accepts websockets (but drops them immediately).
let route = warp::ws()
.map(|ws: warp::ws::Ws| {
ws.on_upgrade(|_| future::ready(()))
});
let client = warp::test::ws()
.handshake(route)
.await
.expect("handshake");
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WsBuilder
impl !RefUnwindSafe for WsBuilder
impl Send for WsBuilder
impl Sync for WsBuilder
impl Unpin for WsBuilder
impl !UnwindSafe for WsBuilder
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