pub struct ClientMux<W>where
W: WebSocketWrite,{ /* private fields */ }
Expand description
Client side multiplexor.
§Example
use wisp_mux::{ClientMux, StreamType};
let (mux, fut) = ClientMux::new(rx, tx).await?;
tokio::spawn(async move {
if let Err(e) = fut.await {
println!("error in multiplexor: {:?}", e);
}
});
let stream = mux.client_new_stream(StreamType::Tcp, "google.com", 80);
Implementations§
source§impl<W: WebSocketWrite + Send + 'static> ClientMux<W>
impl<W: WebSocketWrite + Send + 'static> ClientMux<W>
sourcepub async fn new<R>(
read: R,
write: W
) -> Result<(Self, impl Future<Output = Result<(), WispError>>), WispError>where
R: WebSocketRead,
pub async fn new<R>(
read: R,
write: W
) -> Result<(Self, impl Future<Output = Result<(), WispError>>), WispError>where
R: WebSocketRead,
Create a new client side multiplexor.
sourcepub async fn client_new_stream(
&self,
stream_type: StreamType,
host: String,
port: u16
) -> Result<MuxStream<W>, WispError>
pub async fn client_new_stream( &self, stream_type: StreamType, host: String, port: u16 ) -> Result<MuxStream<W>, WispError>
Create a new stream, multiplexed through Wisp.
Auto Trait Implementations§
impl<W> !RefUnwindSafe for ClientMux<W>
impl<W> Send for ClientMux<W>where
W: Send,
impl<W> Sync for ClientMux<W>where
W: Send,
impl<W> Unpin for ClientMux<W>
impl<W> !UnwindSafe for ClientMux<W>
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