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 fn new() -> Extensions
pub fn new() -> Extensions
Create an empty Extensions store.
pub fn insert<T>(&mut self, val: T) -> &mut Extensions
pub fn insert<T>(&mut self, val: T) -> &mut Extensions
Insert a type into this [Extensions] store.
pub fn extend(&mut self, extensions: Extensions) -> &mut Extensions
pub fn extend(&mut self, extensions: Extensions) -> &mut Extensions
Extend this Extensions store with the [Extension]s from the provided store
pub fn contains<T>(&self) -> bool
pub fn contains<T>(&self) -> bool
Returns true if the Extensions store contains the given type.
pub fn get<T>(&self) -> Option<&T>
pub fn get<T>(&self) -> Option<&T>
Get a shared reference to the most recently insert item of type T
Note: Self::get will return the last added item T, in most cases this is exactly what you want, but
if you need the oldest item T use Self::first
pub fn first<T>(&self) -> Option<&T>
pub fn first<T>(&self) -> Option<&T>
Get a shared reference to the oldest inserted item of type T
Note: Self::first will return the first added item T, in most cases this is not what you want,
instead use Self::get to get the most recently inserted item T
Trait Implementations§
§impl Clone for Extensions
impl Clone for Extensions
§fn clone(&self) -> Extensions
fn clone(&self) -> Extensions
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
§impl ExtensionsMut for Extensions
impl ExtensionsMut for Extensions
§fn extensions_mut(&mut self) -> &mut Extensions
fn extensions_mut(&mut self) -> &mut Extensions
Extensions store§impl ExtensionsRef for Extensions
impl ExtensionsRef for Extensions
§fn extensions(&self) -> &Extensions
fn extensions(&self) -> &Extensions
Extensions store§impl From<Extensions> for RequestExtensions
impl From<Extensions> for RequestExtensions
§fn from(value: Extensions) -> RequestExtensions
fn from(value: Extensions) -> RequestExtensions
§impl FromRequest for Extensions
impl FromRequest for Extensions
§type Rejection = Infallible
type Rejection = Infallible
§async fn from_request(
req: Request,
) -> Result<Extensions, <Extensions as FromRequest>::Rejection>
async fn from_request( req: Request, ) -> Result<Extensions, <Extensions as FromRequest>::Rejection>
§impl IntoResponse for Extensions
impl IntoResponse for Extensions
§fn into_response(self) -> Response
fn into_response(self) -> Response
§impl IntoResponseParts for Extensions
impl IntoResponseParts for Extensions
§type Error = Infallible
type Error = Infallible
§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>
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,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§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<R> IntoEndpointService<()> for R
impl<R> IntoEndpointService<()> for R
§fn into_endpoint_service(
self,
) -> impl Service<Request, Output = Response, Error = Infallible>
fn into_endpoint_service( self, ) -> impl Service<Request, Output = Response, Error = Infallible>
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, Output = Response, Error = Infallible>
fn into_endpoint_service_with_state( self, _state: State, ) -> impl Service<Request, Output = Response, Error = Infallible>
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>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more