Struct Forwarded
pub struct Forwarded { /* private fields */ }Expand description
Forwarding information stored as a chain.
This extension (which can be stored and modified via the Context)
allows to keep track of the forward information. E.g. what was the original
host used by the user, by which proxy it was forwarded, what was the intended
protocol (e.g. https), etc…
Implementations§
§impl Forwarded
impl Forwarded
pub const fn new(element: ForwardedElement) -> Forwarded
pub const fn new(element: ForwardedElement) -> Forwarded
Create a new Forwarded extension for the given ForwardedElement
as the client Element (the first element).
pub fn client_host(&self) -> Option<&ForwardedAuthority>
pub fn client_host(&self) -> Option<&ForwardedAuthority>
Return the client host of this Forwarded context,
if there is one defined.
It is assumed that only the first element can be described as client information.
pub fn client_socket_addr(&self) -> Option<SocketAddr>
pub fn client_socket_addr(&self) -> Option<SocketAddr>
Return the client SocketAddr of this Forwarded context,
if both an Ip and a port are defined.
You can try to fallback to Self::client_ip,
in case this method returns None.
pub fn client_port(&self) -> Option<u16>
pub fn client_port(&self) -> Option<u16>
Return the client port of this Forwarded context,
if there is one defined.
pub fn client_ip(&self) -> Option<IpAddr>
pub fn client_ip(&self) -> Option<IpAddr>
Return the client Ip of this Forwarded context,
if there is one defined.
This method may return None because there is no forwarded “for” information for the client element or because the IP is obfuscated.
It is assumed that only the first element can be described as client information.
pub fn client_proto(&self) -> Option<ForwardedProtocol>
pub fn client_proto(&self) -> Option<ForwardedProtocol>
Return the client protocol of this Forwarded context,
if there is one defined.
pub fn client_version(&self) -> Option<ForwardedVersion>
pub fn client_version(&self) -> Option<ForwardedVersion>
Return the client protocol version of this Forwarded context,
if there is one defined.
pub fn append(&mut self, element: ForwardedElement) -> &mut Forwarded
pub fn append(&mut self, element: ForwardedElement) -> &mut Forwarded
Append a ForwardedElement to this Forwarded context.
pub fn extend(
&mut self,
elements: impl IntoIterator<Item = ForwardedElement>,
) -> &mut Forwarded
pub fn extend( &mut self, elements: impl IntoIterator<Item = ForwardedElement>, ) -> &mut Forwarded
Extend this Forwarded context with the given ForwardedElements.
pub fn iter(&self) -> impl Iterator<Item = &ForwardedElement>
pub fn iter(&self) -> impl Iterator<Item = &ForwardedElement>
Iterate over the ForwardedElements in this Forwarded context.
Trait Implementations§
§impl From<ForwardedElement> for Forwarded
impl From<ForwardedElement> for Forwarded
§fn from(value: ForwardedElement) -> Forwarded
fn from(value: ForwardedElement) -> Forwarded
§impl IntoIterator for Forwarded
impl IntoIterator for Forwarded
§type Item = ForwardedElement
type Item = ForwardedElement
§type IntoIter = Chain<Once<ForwardedElement>, IntoIter<ForwardedElement>>
type IntoIter = Chain<Once<ForwardedElement>, IntoIter<ForwardedElement>>
§impl TryFrom<&HeaderValue> for Forwarded
impl TryFrom<&HeaderValue> for Forwarded
§type Error = OpaqueError
type Error = OpaqueError
§fn try_from(
header: &HeaderValue,
) -> Result<Forwarded, <Forwarded as TryFrom<&HeaderValue>>::Error>
fn try_from( header: &HeaderValue, ) -> Result<Forwarded, <Forwarded as TryFrom<&HeaderValue>>::Error>
§impl TryFrom<HeaderValue> for Forwarded
impl TryFrom<HeaderValue> for Forwarded
§type Error = OpaqueError
type Error = OpaqueError
§fn try_from(
header: HeaderValue,
) -> Result<Forwarded, <Forwarded as TryFrom<HeaderValue>>::Error>
fn try_from( header: HeaderValue, ) -> Result<Forwarded, <Forwarded as TryFrom<HeaderValue>>::Error>
impl Eq for Forwarded
impl StructuralPartialEq for Forwarded
Auto Trait Implementations§
impl Freeze for Forwarded
impl RefUnwindSafe for Forwarded
impl Send for Forwarded
impl Sync for Forwarded
impl Unpin for Forwarded
impl UnwindSafe for Forwarded
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
§impl<T> ToSmolStr for T
impl<T> ToSmolStr for T
fn to_smolstr(&self) -> SmolStr
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.