pub struct Websocket<S> { /* private fields */ }
Implementations§
Source§impl<S> Websocket<S>
impl<S> Websocket<S>
Sourcepub fn new(stream: S) -> Self
pub fn new(stream: S) -> Self
Create a new websocket instance, given any type that implements
AsyncRead + AsyncWrite
like tokio::net::TcpStream
or tokio_native_tls::TlsStream
Sourcepub fn new_with_key(stream: S, key: String) -> Self
pub fn new_with_key(stream: S, key: String) -> Self
Same as Websocket::new
except that it also accept a key that represent
the value of Sec-Websocket-Key
for client that requires a valid
Sec-Websocket-Accept
in response headers.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Websocket<S>
impl<S> !RefUnwindSafe for Websocket<S>
impl<S> Send for Websocket<S>where
S: Send,
impl<S> Sync for Websocket<S>where
S: Sync,
impl<S> Unpin for Websocket<S>
impl<S> !UnwindSafe for Websocket<S>
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