#[non_exhaustive]pub struct RequestMeta {
pub method: Option<String>,
pub original_uri: Option<String>,
pub scheme: Option<String>,
pub peer_addr: Option<SocketAddr>,
pub local_addr: Option<SocketAddr>,
pub extensions: BTreeMap<String, String>,
}Expand description
Action 请求的传输层元数据。
所有字段均可缺失,便于非 HTTP 调用、测试和内部任务继续通过现有
Request::new(body) / ActionContext::new(request, tools) 构造。耗时不属于本结构,
应由 dispatch span 或 metrics 在执行完成后计算。
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.method: Option<String>原始请求方法,例如 GET、POST。
original_uri: Option<String>传输适配器观察到的原始 URI;可能包含敏感 query,因此 Debug 始终脱敏。
scheme: Option<String>URI scheme,例如 http、https。
peer_addr: Option<SocketAddr>对端网络地址。
local_addr: Option<SocketAddr>本地监听地址。
extensions: BTreeMap<String, String>传输适配器附加的可选字符串元数据。
使用有序映射使测试、诊断和后续 catalog 投影保持确定性;Debug 只展示 key。
Implementations§
Source§impl RequestMeta
impl RequestMeta
Sourcepub fn with_method(self, method: impl Into<String>) -> Self
pub fn with_method(self, method: impl Into<String>) -> Self
设置请求方法。
Sourcepub fn with_original_uri(self, uri: impl Into<String>) -> Self
pub fn with_original_uri(self, uri: impl Into<String>) -> Self
设置原始 URI。
Sourcepub fn with_scheme(self, scheme: impl Into<String>) -> Self
pub fn with_scheme(self, scheme: impl Into<String>) -> Self
设置 URI scheme。
Sourcepub fn with_peer_addr(self, peer_addr: SocketAddr) -> Self
pub fn with_peer_addr(self, peer_addr: SocketAddr) -> Self
设置对端地址。
Sourcepub fn with_local_addr(self, local_addr: SocketAddr) -> Self
pub fn with_local_addr(self, local_addr: SocketAddr) -> Self
设置本地监听地址。
Trait Implementations§
Source§impl Clone for RequestMeta
impl Clone for RequestMeta
Source§impl Debug for RequestMeta
impl Debug for RequestMeta
Source§impl Default for RequestMeta
impl Default for RequestMeta
impl Eq for RequestMeta
Source§impl PartialEq for RequestMeta
impl PartialEq for RequestMeta
impl StructuralPartialEq for RequestMeta
Auto Trait Implementations§
impl Forget for RequestMeta
impl Freeze for RequestMeta
impl Move for RequestMeta
impl RefUnwindSafe for RequestMeta
impl Send for RequestMeta
impl Sync for RequestMeta
impl Unpin for RequestMeta
impl UnsafeUnpin for RequestMeta
impl UnwindSafe for RequestMeta
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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