pub struct RequestContext {
pub trace: TraceContext,
pub start_time: Instant,
pub timeout: Option<Duration>,
pub debug_request: bool,
}Expand description
Request context for protocol operations.
This is a specialized context for protocol-level requests.
Fields§
§trace: TraceContextBase trace context.
start_time: InstantRequest start time.
timeout: Option<Duration>Request timeout (if set).
debug_request: boolWhether this request should be logged at debug level.
Implementations§
Source§impl RequestContext
impl RequestContext
Sourcepub fn with_trace(trace: TraceContext) -> Self
pub fn with_trace(trace: TraceContext) -> Self
Create with an existing trace context.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set a timeout.
Sourcepub fn is_timed_out(&self) -> bool
pub fn is_timed_out(&self) -> bool
Check if the request has timed out.
Sourcepub fn remaining_timeout(&self) -> Option<Duration>
pub fn remaining_timeout(&self) -> Option<Duration>
Get remaining time before timeout.
Sourcepub fn request_id(&self) -> &str
pub fn request_id(&self) -> &str
Get the request ID.
Trait Implementations§
Source§impl Clone for RequestContext
impl Clone for RequestContext
Source§fn clone(&self) -> RequestContext
fn clone(&self) -> RequestContext
Returns a duplicate of the value. Read more
1.0.0 · 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 RequestContext
impl Debug for RequestContext
Auto Trait Implementations§
impl Freeze for RequestContext
impl RefUnwindSafe for RequestContext
impl Send for RequestContext
impl Sync for RequestContext
impl Unpin for RequestContext
impl UnsafeUnpin for RequestContext
impl UnwindSafe 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