pub struct SecWebSocketProtocol(pub NonEmptySmallVec<3, NonEmptyStr>);Expand description
The Sec-WebSocket-Protocol header, containing one or multiple protocols.
Sub protocols are advertised by the client, and the server has to match it if defined.
Tuple Fields§
§0: NonEmptySmallVec<3, NonEmptyStr>Implementations§
Source§impl SecWebSocketProtocol
impl SecWebSocketProtocol
pub fn new(value: NonEmptyStr) -> Self
Source§impl SecWebSocketProtocol
impl SecWebSocketProtocol
Sourcepub fn accept_first_protocol(&self) -> AcceptedWebSocketProtocol
pub fn accept_first_protocol(&self) -> AcceptedWebSocketProtocol
Return the first protocol in this SecWebSocketProtocol as the AcceptedWebSocketProtocol.
Sourcepub fn contains(
&self,
protocol: impl AsRef<str>,
) -> Option<AcceptedWebSocketProtocol>
pub fn contains( &self, protocol: impl AsRef<str>, ) -> Option<AcceptedWebSocketProtocol>
returns true if the given protocol is found in this SecWebSocketProtocol
Sourcepub fn contains_any(
&self,
protocols: impl IntoIterator<Item: AsRef<str>>,
) -> Option<AcceptedWebSocketProtocol>
pub fn contains_any( &self, protocols: impl IntoIterator<Item: AsRef<str>>, ) -> Option<AcceptedWebSocketProtocol>
returns true if any of the given protocol is found in this SecWebSocketProtocol
Searched in order.
pub fn iter(&self) -> impl Iterator<Item = &str>
Trait Implementations§
Source§impl Clone for SecWebSocketProtocol
impl Clone for SecWebSocketProtocol
Source§fn clone(&self) -> SecWebSocketProtocol
fn clone(&self) -> SecWebSocketProtocol
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecWebSocketProtocol
impl Debug for SecWebSocketProtocol
impl Eq for SecWebSocketProtocol
Source§impl From<AcceptedWebSocketProtocol> for SecWebSocketProtocol
impl From<AcceptedWebSocketProtocol> for SecWebSocketProtocol
Source§fn from(value: AcceptedWebSocketProtocol) -> Self
fn from(value: AcceptedWebSocketProtocol) -> Self
Converts to this type from the input type.
Source§impl HeaderDecode for SecWebSocketProtocol
impl HeaderDecode for SecWebSocketProtocol
Source§fn decode<'i, I>(values: &mut I) -> Result<Self, Error>where
I: Iterator<Item = &'i HeaderValue>,
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>where
I: Iterator<Item = &'i HeaderValue>,
Decode this type from an iterator of
HeaderValues.Source§impl HeaderEncode for SecWebSocketProtocol
impl HeaderEncode for SecWebSocketProtocol
Source§fn encode<E: Extend<HeaderValue>>(&self, values: &mut E)
fn encode<E: Extend<HeaderValue>>(&self, values: &mut E)
Encode this type to a
HeaderValue, and add it to a container
which has HeaderValue type as each element. Read moreSource§fn encode_to_value(&self) -> Option<HeaderValue>
fn encode_to_value(&self) -> Option<HeaderValue>
Encode this header to
HeaderValue. Read moreSource§impl PartialEq for SecWebSocketProtocol
impl PartialEq for SecWebSocketProtocol
Source§fn eq(&self, other: &SecWebSocketProtocol) -> bool
fn eq(&self, other: &SecWebSocketProtocol) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SecWebSocketProtocol
Source§impl TypedHeader for SecWebSocketProtocol
impl TypedHeader for SecWebSocketProtocol
Source§fn name() -> &'static HeaderName
fn name() -> &'static HeaderName
The name of this header.
Auto Trait Implementations§
impl Freeze for SecWebSocketProtocol
impl RefUnwindSafe for SecWebSocketProtocol
impl Send for SecWebSocketProtocol
impl Sync for SecWebSocketProtocol
impl Unpin for SecWebSocketProtocol
impl UnsafeUnpin for SecWebSocketProtocol
impl UnwindSafe for SecWebSocketProtocol
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more