pub struct MiddlewareContext {
pub request_id: Option<String>,
pub metadata: Arc<DashMap<String, String>>,
pub metrics: Arc<PerformanceMetrics>,
pub start_time: Instant,
pub priority: Option<MessagePriority>,
}Expand description
Execution context for middleware chains with performance tracking.
Fields§
§request_id: Option<String>Request ID for correlation
metadata: Arc<DashMap<String, String>>Custom metadata that can be passed between middleware
metrics: Arc<PerformanceMetrics>Performance metrics for the request
start_time: InstantStart time of the middleware chain execution
priority: Option<MessagePriority>Priority level for the request
Implementations§
Source§impl MiddlewareContext
impl MiddlewareContext
Sourcepub fn with_request_id(request_id: String) -> Self
pub fn with_request_id(request_id: String) -> Self
Create a new context with request ID
Sourcepub fn set_metadata(&self, key: String, value: String)
pub fn set_metadata(&self, key: String, value: String)
Set metadata value
Sourcepub fn get_metadata(&self, key: &str) -> Option<String>
pub fn get_metadata(&self, key: &str) -> Option<String>
Get metadata value
Sourcepub fn record_metric(&self, name: String, value: f64)
pub fn record_metric(&self, name: String, value: f64)
Record a metric
Trait Implementations§
Source§impl Clone for MiddlewareContext
impl Clone for MiddlewareContext
Source§fn clone(&self) -> MiddlewareContext
fn clone(&self) -> MiddlewareContext
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 MiddlewareContext
impl Debug for MiddlewareContext
Auto Trait Implementations§
impl !RefUnwindSafe for MiddlewareContext
impl !UnwindSafe for MiddlewareContext
impl Freeze for MiddlewareContext
impl Send for MiddlewareContext
impl Sync for MiddlewareContext
impl Unpin for MiddlewareContext
impl UnsafeUnpin for MiddlewareContext
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