Struct websocket::server::response::Response [] [src]

pub struct Response<R: Read, W: Write> {
    pub status: StatusCode,
    pub headers: Headers,
    pub version: HttpVersion,
    // some fields omitted
}

Represents a server-side (outgoing) response.

Fields

status

The status of the response

headers

The headers contained in this response

version

The HTTP version of this response

Methods

impl<R: Read, W: Write> Response<R, W>

fn accept(&self) -> Option<&WebSocketAccept>

Short-cut to obtain the WebSocketAccept value

fn protocol(&self) -> Option<&WebSocketProtocol>

Short-cut to obtain the WebSocketProtocol value

fn extensions(&self) -> Option<&WebSocketExtensions>

Short-cut to obtain the WebSocketExtensions value

fn get_reader(&self) -> &R

Returns a reference to the inner Reader.

fn get_writer(&self) -> &W

Returns a reference to the inner Writer.

fn get_mut_reader(&mut self) -> &mut R

Returns a mutable reference to the inner Reader.

fn get_mut_writer(&mut self) -> &mut W

Returns a mutable reference to the inner Writer.

fn get_request(&self) -> &Request<R, W>

Returns a reference to the request associated with this response/

fn into_inner(self) -> (R, W)

Return the inner Reader and Writer

fn new(request: Request<R, W>) -> Response<R, W>

Create a new outbound WebSocket response.

fn bad_request(request: Request<R, W>) -> Response<R, W>

Create a Bad Request response

fn accept_mut(&mut self) -> Option<&mut WebSocketAccept>

Short-cut to obtain a mutable reference to the WebSocketAccept value Note that to add a header that does not already exist, WebSocketResponse.headers.set() must be used.

fn protocol_mut(&mut self) -> Option<&mut WebSocketProtocol>

Short-cut to obtain a mutable reference to the WebSocketProtocol value Note that to add a header that does not already exist, WebSocketResponse.headers.set() must be used.

fn extensions_mut(&mut self) -> Option<&mut WebSocketExtensions>

Short-cut to obtain a mutable reference to the WebSocketExtensions value Note that to add a header that does not already exist, WebSocketResponse.headers.set() must be used.

fn send_with<D, B, C>(self, sender: B, receiver: C) -> WebSocketResult<Client<D, B, C>> where B: Sender, C: Receiver<D>, D: DataFrameable

Send this response with the given data frame type D, Sender B and Receiver C.

fn send_into_inner(self) -> WebSocketResult<(R, W)>

Send this response, retrieving the inner Reader and Writer

fn send(self) -> WebSocketResult<Client<DataFrame, Sender<W>, Receiver<R>>>

Send this response, returning a Client ready to transmit/receive data frames

Trait Implementations

impl<R, W> Send for Response<R, W> where R: Read + Send, W: Write + Send