Struct Extensions
pub struct Extensions { /* private fields */ }Expand description
A type map of protocol extensions.
Extensions can be used by Request and Response to store
extra data derived from the underlying protocol.
Implementations§
§impl Extensions
impl Extensions
pub const fn new() -> Extensions
pub const fn new() -> Extensions
Create an empty Extensions.
pub fn into_frozen_extensions(self) -> Arc<Extensions>
pub fn into_frozen_extensions(self) -> Arc<Extensions>
Convert Extensions into a frozen/readonly variant
pub fn maybe_with_parent_extensions(
self,
frozen_extensions: Option<Arc<Extensions>>,
) -> Extensions
pub fn maybe_with_parent_extensions( self, frozen_extensions: Option<Arc<Extensions>>, ) -> Extensions
Set parent extensions
pub fn maybe_set_parent_extensions(
&mut self,
frozen_extensions: Option<Arc<Extensions>>,
) -> &mut Extensions
pub fn maybe_set_parent_extensions( &mut self, frozen_extensions: Option<Arc<Extensions>>, ) -> &mut Extensions
Set parent extensions
pub fn with_parent_extensions(
self,
frozen_extensions: Arc<Extensions>,
) -> Extensions
pub fn with_parent_extensions( self, frozen_extensions: Arc<Extensions>, ) -> Extensions
Set parent extensions
pub fn set_parent_extensions(
&mut self,
frozen_extensions: Arc<Extensions>,
) -> &mut Extensions
pub fn set_parent_extensions( &mut self, frozen_extensions: Arc<Extensions>, ) -> &mut Extensions
Set parent extensions
pub fn without_parent_extensions(self) -> Extensions
pub fn without_parent_extensions(self) -> Extensions
Set parent extensions
pub fn unset_parent_extensions(&mut self) -> &mut Extensions
pub fn unset_parent_extensions(&mut self) -> &mut Extensions
Set parent extensions
pub fn insert<T>(&mut self, val: T) -> Option<T>
pub fn insert<T>(&mut self, val: T) -> Option<T>
Insert a type into this Extensions.
If a extension of this type already existed, it will be returned.
pub fn insert_mut<T>(&mut self, val: T) -> &mut T
pub fn insert_mut<T>(&mut self, val: T) -> &mut T
Insert a type into this Extensions and get mutable reference
pub fn maybe_insert<T>(&mut self, val: Option<T>) -> Option<T>
pub fn maybe_insert<T>(&mut self, val: Option<T>) -> Option<T>
Insert a type only into this Extensions, if the value is Some(T).
See Self::insert for more information.
pub fn extend(&mut self, other: Extensions)
pub fn extend(&mut self, other: Extensions)
Extend these extensions with another Extensions.
pub fn clear(&mut self)
pub fn clear(&mut self)
Clear the Extensions of all inserted extensions.
Trait Implementations§
§impl AsMut<Extensions> for RequestContextExt
impl AsMut<Extensions> for RequestContextExt
§fn as_mut(&mut self) -> &mut Extensions
fn as_mut(&mut self) -> &mut Extensions
Converts this type into a mutable reference of the (usually inferred) input type.
§impl AsRef<Extensions> for RequestContextExt
impl AsRef<Extensions> for RequestContextExt
§fn as_ref(&self) -> &Extensions
fn as_ref(&self) -> &Extensions
Converts this type into a shared reference of the (usually inferred) input type.
§impl Clone for Extensions
impl Clone for Extensions
§fn clone(&self) -> Extensions
fn clone(&self) -> Extensions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for Extensions
impl Debug for Extensions
§impl Default for Extensions
impl Default for Extensions
§fn default() -> Extensions
fn default() -> Extensions
Returns the “default value” for a type. Read more
§impl ExtensionsMut for Extensions
impl ExtensionsMut for Extensions
§fn extensions_mut(&mut self) -> &mut Extensions
fn extensions_mut(&mut self) -> &mut Extensions
Get mutable reference to the underlying
Extensions storefn take_extensions(&mut self) -> Extensions
§impl ExtensionsRef for Extensions
impl ExtensionsRef for Extensions
§fn extensions(&self) -> &Extensions
fn extensions(&self) -> &Extensions
Get reference to the underlying
Extensions store§impl From<Extensions> for RequestContextExt
impl From<Extensions> for RequestContextExt
§fn from(value: Extensions) -> RequestContextExt
fn from(value: Extensions) -> RequestContextExt
Converts to this type from the input type.
§impl From<Extensions> for RequestExtensions
impl From<Extensions> for RequestExtensions
§fn from(value: Extensions) -> RequestExtensions
fn from(value: Extensions) -> RequestExtensions
Converts to this type from the input type.
§impl From<RequestContextExt> for Extensions
impl From<RequestContextExt> for Extensions
§fn from(value: RequestContextExt) -> Extensions
fn from(value: RequestContextExt) -> Extensions
Converts to this type from the input type.
§impl<State> FromRequestContextRefPair<State> for Extensions
impl<State> FromRequestContextRefPair<State> for Extensions
§type Rejection = Infallible
type Rejection = Infallible
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
§async fn from_request_context_ref_pair(
parts: &Parts,
_state: &State,
) -> Result<Extensions, <Extensions as FromRequestContextRefPair<State>>::Rejection>
async fn from_request_context_ref_pair( parts: &Parts, _state: &State, ) -> Result<Extensions, <Extensions as FromRequestContextRefPair<State>>::Rejection>
Perform the extraction.
§impl IntoResponse for Extensions
impl IntoResponse for Extensions
§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
§impl IntoResponseParts for Extensions
impl IntoResponseParts for Extensions
§type Error = Infallible
type Error = Infallible
The type returned in the event of an error. Read more
§fn into_response_parts(
self,
res: ResponseParts,
) -> Result<ResponseParts, <Extensions as IntoResponseParts>::Error>
fn into_response_parts( self, res: ResponseParts, ) -> Result<ResponseParts, <Extensions as IntoResponseParts>::Error>
Set parts of the response
Auto Trait Implementations§
impl Freeze for Extensions
impl !RefUnwindSafe for Extensions
impl Send for Extensions
impl Sync for Extensions
impl Unpin for Extensions
impl !UnwindSafe for Extensions
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
Mutably borrows from an owned value. Read more
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> ⓘ
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§impl<R> IntoEndpointService<()> for R
impl<R> IntoEndpointService<()> for R
§fn into_endpoint_service(
self,
) -> impl Service<Request, Response = Response, Error = Infallible>
fn into_endpoint_service( self, ) -> impl Service<Request, Response = Response, Error = Infallible>
convert the type into a
rama_core::Service.§impl<R, State> IntoEndpointServiceWithState<(), State> for R
impl<R, State> IntoEndpointServiceWithState<(), State> for R
§fn into_endpoint_service_with_state(
self,
_state: State,
) -> impl Service<Request, Response = Response, Error = Infallible>
fn into_endpoint_service_with_state( self, _state: State, ) -> impl Service<Request, Response = Response, Error = Infallible>
convert the type into a
rama_core::Service with state.§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>
Create a new
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more