pub struct MuxStream<W>where
W: WebSocketWrite,{
pub stream_id: u32,
/* private fields */
}
Expand description
Multiplexor stream.
Fields§
§stream_id: u32
ID of the stream.
Implementations§
source§impl<W: WebSocketWrite + Send + 'static> MuxStream<W>
impl<W: WebSocketWrite + Send + 'static> MuxStream<W>
sourcepub fn get_close_handle(&self) -> MuxStreamCloser
pub fn get_close_handle(&self) -> MuxStreamCloser
Get a handle to close the connection.
Useful to close the connection without having access to the stream.
§Example
let handle = stream.get_close_handle();
if let Err(error) = handle_stream(stream) {
handle.close(0x01);
}
sourcepub async fn close(&self, reason: CloseReason) -> Result<(), WispError>
pub async fn close(&self, reason: CloseReason) -> Result<(), WispError>
Close the stream. You will no longer be able to write or read after this has been called.
sourcepub fn into_split(self) -> (MuxStreamRead<W>, MuxStreamWrite<W>)
pub fn into_split(self) -> (MuxStreamRead<W>, MuxStreamWrite<W>)
Split the stream into read and write parts, consuming it.
sourcepub fn into_io(self) -> MuxStreamIo
pub fn into_io(self) -> MuxStreamIo
Turn the stream into one that implements futures Stream + Sink
, consuming it.
Auto Trait Implementations§
impl<W> !RefUnwindSafe for MuxStream<W>
impl<W> Send for MuxStream<W>where
W: Send,
impl<W> Sync for MuxStream<W>where
W: Send,
impl<W> Unpin for MuxStream<W>
impl<W> !UnwindSafe for MuxStream<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