Struct tonic::Extensions 
source · pub struct Extensions { /* private fields */ }Expand description
A type map of protocol extensions.
Extensions can be used by Interceptor and Request to store extra data derived from
the underlying protocol.
Implementations§
source§impl Extensions
 
impl Extensions
sourcepub fn insert<T: Send + Sync + 'static>(&mut self, val: T) -> Option<T>
 
pub fn insert<T: Send + Sync + 'static>(&mut self, val: T) -> Option<T>
Insert a type into this Extensions.
If a extension of this type already existed, it will be returned.
sourcepub fn get<T: Send + Sync + 'static>(&self) -> Option<&T>
 
pub fn get<T: Send + Sync + 'static>(&self) -> Option<&T>
Get a reference to a type previously inserted on this Extensions.
sourcepub fn get_mut<T: Send + Sync + 'static>(&mut self) -> Option<&mut T>
 
pub fn get_mut<T: Send + Sync + 'static>(&mut self) -> Option<&mut T>
Get a mutable reference to a type previously inserted on this Extensions.
sourcepub fn remove<T: Send + Sync + 'static>(&mut self) -> Option<T>
 
pub fn remove<T: Send + Sync + 'static>(&mut self) -> Option<T>
Remove a type from this Extensions.
If a extension of this type existed, it will be returned.
sourcepub fn into_http(self) -> Extensions
 
pub fn into_http(self) -> Extensions
Convert to http::Extensions and consume self.
Trait Implementations§
source§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 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§
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> 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> IntoRequest<T> for T
 
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
 
fn into_request(self) -> Request<T>
Wrap the input message 
T in a tonic::Request