pub struct HttpContext {
pub request: RequestContext,
pub response: ResponseContext,
pub inner_state: InnerState,
pub state: DashMap<String, Value>,
}Expand description
HTTP上下文
Fields§
§request: RequestContext请求上下文,在请求阶段构建
response: ResponseContext响应上下文,在构建请求上下文时同步构建,在响应阶段更新
inner_state: InnerState内部扩展数据
state: DashMap<String, Value>自定义的扩展数据
Implementations§
Source§impl HttpContext
impl HttpContext
pub fn insert_state<T: Serialize>(&self, key: &str, value: T)
pub fn get_state<T: DeserializeOwned>( &self, key: &str, ) -> Result<Option<T>, Error>
pub fn remove_state(&self, key: &str)
Trait Implementations§
Source§impl Debug for HttpContext
impl Debug for HttpContext
Source§impl Default for HttpContext
impl Default for HttpContext
Source§fn default() -> HttpContext
fn default() -> HttpContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for HttpContext
impl !RefUnwindSafe for HttpContext
impl Send for HttpContext
impl Sync for HttpContext
impl Unpin for HttpContext
impl !UnwindSafe for HttpContext
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