Struct Connection
pub struct Connection(/* private fields */);
Expand description
Connection
header, defined in
RFC7230
The Connection
header field allows the sender to indicate desired
control options for the current connection. In order to avoid
confusing downstream recipients, a proxy or gateway MUST remove or
replace any received connection options before forwarding the
message.
§ABNF
Connection = 1#connection-option
connection-option = token
# Example values
* `close`
* `keep-alive`
* `upgrade`
§Examples
use rama_http_headers::Connection;
let keep_alive = Connection::keep_alive();
Implementations§
§impl Connection
impl Connection
pub fn close() -> Connection
pub fn close() -> Connection
A constructor to easily create a Connection: close
header.
pub fn contains_close(&self) -> bool
pub fn contains_close(&self) -> bool
Returns true if this Connection
header contains close
.
pub fn keep_alive() -> Connection
pub fn keep_alive() -> Connection
A constructor to easily create a Connection: keep-alive
header.
pub fn contains_keep_alive(&self) -> bool
pub fn contains_keep_alive(&self) -> bool
Returns true if this Connection
header contains keep-alive
.
pub fn upgrade() -> Connection
pub fn upgrade() -> Connection
A constructor to easily create a Connection: Upgrade
header.
pub fn contains_upgrade(&self) -> bool
pub fn contains_upgrade(&self) -> bool
Returns true if this Connection
header contains Upgrade
.
pub fn contains(&self, name: impl AsConnectionOption) -> bool
pub fn contains(&self, name: impl AsConnectionOption) -> bool
Check if this header contains a given “connection option”.
This can be used with various argument types:
&str
&HeaderName
HeaderName
§Example
use rama_http_types::header::UPGRADE;
use rama_http_headers::Connection;
let conn = Connection::keep_alive();
assert!(!conn.contains("close"));
assert!(!conn.contains(UPGRADE));
assert!(conn.contains("keep-alive"));
assert!(conn.contains("Keep-Alive"));
Trait Implementations§
§impl Clone for Connection
impl Clone for Connection
§fn clone(&self) -> Connection
fn clone(&self) -> Connection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for Connection
impl Debug for Connection
§impl FromIterator<HeaderName> for Connection
impl FromIterator<HeaderName> for Connection
§fn from_iter<I>(iter: I) -> Connectionwhere
I: IntoIterator<Item = HeaderName>,
fn from_iter<I>(iter: I) -> Connectionwhere
I: IntoIterator<Item = HeaderName>,
§impl HeaderDecode for Connection
impl HeaderDecode for Connection
§fn decode<'i, I>(values: &mut I) -> Result<Connection, Error>where
I: Iterator<Item = &'i HeaderValue>,
fn decode<'i, I>(values: &mut I) -> Result<Connection, Error>where
I: Iterator<Item = &'i HeaderValue>,
HeaderValue
s.§impl HeaderEncode for Connection
impl HeaderEncode for Connection
§fn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
fn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
HeaderValue
, and add it to a container
which has HeaderValue
type as each element. Read more§fn encode_to_value(&self) -> HeaderValue
fn encode_to_value(&self) -> HeaderValue
HeaderValue
.§impl TypedHeader for Connection
impl TypedHeader for Connection
§fn name() -> &'static HeaderName
fn name() -> &'static HeaderName
Auto Trait Implementations§
impl !Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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> ⓘ
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> ⓘ
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more