Struct websocket::header::WebSocketProtocol
[−]
[src]
pub struct WebSocketProtocol(pub Vec<String>);
Represents a Sec-WebSocket-Protocol header
Methods from Deref<Target = Vec<String>>
pub fn capacity(&self) -> usize
1.0.0[src]
Returns the number of elements the vector can hold without reallocating.
Examples
let vec: Vec<i32> = Vec::with_capacity(10); assert_eq!(vec.capacity(), 10);
pub fn as_slice(&self) -> &[T]
1.7.0[src]
Extracts a slice containing the entire vector.
Equivalent to &s[..]
.
Examples
use std::io::{self, Write}; let buffer = vec![1, 2, 3, 5, 8]; io::sink().write(buffer.as_slice()).unwrap();
pub fn len(&self) -> usize
1.0.0[src]
Returns the number of elements in the vector, also referred to as its 'length'.
Examples
let a = vec![1, 2, 3]; assert_eq!(a.len(), 3);
pub fn is_empty(&self) -> bool
1.0.0[src]
Returns true
if the vector contains no elements.
Examples
let mut v = Vec::new(); assert!(v.is_empty()); v.push(1); assert!(!v.is_empty());
Trait Implementations
impl PartialEq for WebSocketProtocol
[src]
fn eq(&self, __arg_0: &WebSocketProtocol) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &WebSocketProtocol) -> bool
[src]
This method tests for !=
.
impl Clone for WebSocketProtocol
[src]
fn clone(&self) -> WebSocketProtocol
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for WebSocketProtocol
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Deref for WebSocketProtocol
[src]
type Target = Vec<String>
The resulting type after dereferencing.
fn deref(&self) -> &Vec<String>
[src]
Dereferences the value.
impl Header for WebSocketProtocol
[src]
fn header_name() -> &'static str
[src]
Returns the name of the header field this belongs to. Read more
fn parse_header(raw: &[Vec<u8>]) -> Result<WebSocketProtocol>
[src]
Parse a header from a raw stream of bytes. Read more
impl HeaderFormat for WebSocketProtocol
[src]
fn fmt_header(&self, fmt: &mut Formatter) -> Result
[src]
Format a header to be output into a TcpStream. Read more