pub struct Server<'a, T> { /* private fields */ }
Expand description
Websocket handshake server.
Implementations§
source§impl<'a, T: AsyncRead + AsyncWrite + Unpin> Server<'a, T>
impl<'a, T: AsyncRead + AsyncWrite + Unpin> Server<'a, T>
sourcepub fn set_buffer(&mut self, b: BytesMut) -> &mut Self
pub fn set_buffer(&mut self, b: BytesMut) -> &mut Self
Override the buffer to use for request/response handling.
sourcepub fn take_buffer(&mut self) -> BytesMut
pub fn take_buffer(&mut self) -> BytesMut
Extract the buffer.
sourcepub fn add_protocol(&mut self, p: &'a str) -> &mut Self
pub fn add_protocol(&mut self, p: &'a str) -> &mut Self
Add a protocol the server supports.
sourcepub fn add_extension(&mut self, e: Box<dyn Extension + Send>) -> &mut Self
pub fn add_extension(&mut self, e: Box<dyn Extension + Send>) -> &mut Self
Add an extension the server supports.
sourcepub fn drain_extensions(
&mut self,
) -> impl Iterator<Item = Box<dyn Extension + Send>> + '_
pub fn drain_extensions( &mut self, ) -> impl Iterator<Item = Box<dyn Extension + Send>> + '_
Get back all extensions.
sourcepub async fn receive_request(&mut self) -> Result<ClientRequest<'_>, Error>
pub async fn receive_request(&mut self) -> Result<ClientRequest<'_>, Error>
Await an incoming client handshake request.
sourcepub async fn send_response(&mut self, r: &Response<'_>) -> Result<(), Error>
pub async fn send_response(&mut self, r: &Response<'_>) -> Result<(), Error>
Respond to the client.
sourcepub fn into_builder(self) -> Builder<T>
pub fn into_builder(self) -> Builder<T>
Turn this handshake into a connection::Builder
.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Get out the inner socket of the server.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Server<'a, T>where
T: Freeze,
impl<'a, T> !RefUnwindSafe for Server<'a, T>
impl<'a, T> Send for Server<'a, T>where
T: Send,
impl<'a, T> !Sync for Server<'a, T>
impl<'a, T> Unpin for Server<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for Server<'a, T>
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