Struct parity_ws::Response [−][src]
The handshake response.
Implementations
impl Response
[src]
pub fn new<R>(status: u16, reason: R, body: Vec<u8>) -> Response where
R: Into<String>,
[src]
R: Into<String>,
Construct a generic HTTP response with a body.
pub fn body(&self) -> &[u8]ⓘ
[src]
Get the response body.
pub fn header_mut(&mut self, header: &str) -> Option<&mut Vec<u8>>
[src]
Edit the value of the first instance of an HTTP header.
pub fn headers(&self) -> &Vec<(String, Vec<u8>)>ⓘ
[src]
Access the request headers.
pub fn headers_mut(&mut self) -> &mut Vec<(String, Vec<u8>)>ⓘ
[src]
Edit the request headers.
pub fn status(&self) -> u16
[src]
Get the HTTP status code.
pub fn set_status(&mut self, status: u16)
[src]
Set the HTTP status code.
pub fn reason(&self) -> &str
[src]
Get the HTTP status reason.
pub fn set_reason<R>(&mut self, reason: R) where
R: Into<String>,
[src]
R: Into<String>,
Set the HTTP status reason.
pub fn key(&self) -> Result<&Vec<u8>>
[src]
Get the hashed WebSocket key.
pub fn protocol(&self) -> Result<Option<&str>>
[src]
Get the protocol that the server has decided to use.
pub fn set_protocol(&mut self, protocol: &str)
[src]
Set the protocol that the server has decided to use.
pub fn extensions(&self) -> Result<Vec<&str>>
[src]
Get the extensions that the server has decided to use. If these are unacceptable, it is appropriate to send an Extension close code.
pub fn add_extension(&mut self, ext: &str)
[src]
Add an accepted extension to this response. This may result in duplicate extensions listed.
pub fn remove_extension(&mut self, ext: &str)
[src]
Remove an accepted extension from this response. This will remove all configurations of the extension.
pub fn parse(buf: &[u8]) -> Result<Option<Response>>
[src]
Attempt to parse an HTTP response from a buffer. If the buffer does not contain a complete
response, thiw will return Ok(None)
.
pub fn from_request(req: &Request) -> Result<Response>
[src]
Construct a new WebSocket handshake HTTP response from a request. This will create a response that ignores protocols and extensions. Edit this response to accept a protocol and extensions as necessary.
pub fn format<W>(&self, w: &mut W) -> Result<()> where
W: Write,
[src]
W: Write,
Write a response out to a buffer
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,