pub struct Extensions { /* private fields */ }Expand description
A type-keyed map for attaching arbitrary data to a connection or request.
Modelled on http::Extensions, implemented here to avoid the dependency. Used to
carry attestation on a connection and verified mission-token claims on a request,
without either concept leaking into this crate’s core types.
Stored values must be Clone so that the containing RequestContext stays
Clone.
Implementations§
Source§impl Extensions
impl Extensions
pub fn new() -> Self
Sourcepub fn insert<T: Clone + Send + Sync + 'static>(
&mut self,
value: T,
) -> Option<T>
pub fn insert<T: Clone + Send + Sync + 'static>( &mut self, value: T, ) -> Option<T>
Insert a value, returning the previous one of the same type, if any.
pub fn get<T: Clone + Send + Sync + 'static>(&self) -> Option<&T>
pub fn get_mut<T: Clone + Send + Sync + 'static>(&mut self) -> Option<&mut T>
pub fn remove<T: Clone + Send + Sync + 'static>(&mut self) -> Option<T>
pub fn contains<T: Clone + Send + Sync + 'static>(&self) -> bool
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Trait Implementations§
Source§impl Clone for Extensions
impl Clone for Extensions
Source§fn clone(&self) -> Extensions
fn clone(&self) -> Extensions
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 Extensions
impl Debug for Extensions
Source§impl Default for Extensions
impl Default for Extensions
Source§fn default() -> Extensions
fn default() -> Extensions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for Extensions
impl !UnwindSafe for Extensions
impl Freeze for Extensions
impl Send for Extensions
impl Sync for Extensions
impl Unpin for Extensions
impl UnsafeUnpin for Extensions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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