pub struct RequestContext { /* private fields */ }Expand description
当前请求独占的类型化扩展值集合。
Implementations§
Source§impl RequestContext
impl RequestContext
Sourcepub fn insert<T>(&mut self, key: ContextKey<T>, value: T)
pub fn insert<T>(&mut self, key: ContextKey<T>, value: T)
插入或替换一个类型化值。
Sourcepub fn get<T>(&self, key: ContextKey<T>) -> Option<&T>
pub fn get<T>(&self, key: ContextKey<T>) -> Option<&T>
读取一个类型化值;名称相同但类型不同时返回 None。
Trait Implementations§
Source§impl Debug for RequestContext
impl Debug for RequestContext
Auto Trait Implementations§
impl !RefUnwindSafe for RequestContext
impl !UnwindSafe for RequestContext
impl Forget for RequestContext
impl Freeze for RequestContext
impl Move for RequestContext
impl Send for RequestContext
impl Sync for RequestContext
impl Unpin for RequestContext
impl UnsafeUnpin for RequestContext
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> 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