pub struct ResponseContext {
pub request_context: RequestContext,
pub response: Option<Value>,
pub error: Option<Error>,
pub duration: Duration,
pub metadata: HashMap<String, Value>,
}
Expand description
Context for response processing
Fields§
§request_context: RequestContext
The original request context
response: Option<Value>
The response data (if successful)
error: Option<Error>
Error information (if failed)
duration: Duration
Request duration
metadata: HashMap<String, Value>
Additional metadata (can be modified by plugins)
Implementations§
Source§impl ResponseContext
impl ResponseContext
Sourcepub fn new(
request_context: RequestContext,
response: Option<Value>,
error: Option<Error>,
duration: Duration,
) -> Self
pub fn new( request_context: RequestContext, response: Option<Value>, error: Option<Error>, duration: Duration, ) -> Self
Create a new response context
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the response was successful
Sourcepub fn add_metadata(&mut self, key: String, value: Value)
pub fn add_metadata(&mut self, key: String, value: Value)
Add metadata
Sourcepub fn get_metadata(&self, key: &str) -> Option<&Value>
pub fn get_metadata(&self, key: &str) -> Option<&Value>
Get metadata value
Trait Implementations§
Source§impl Clone for ResponseContext
impl Clone for ResponseContext
Source§fn clone(&self) -> ResponseContext
fn clone(&self) -> ResponseContext
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 moreAuto Trait Implementations§
impl !Freeze for ResponseContext
impl RefUnwindSafe for ResponseContext
impl Send for ResponseContext
impl Sync for ResponseContext
impl Unpin for ResponseContext
impl UnwindSafe for ResponseContext
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