pub struct ServerRequest<'a> { /* private fields */ }Expand description
Middleware-facing view of one decoded server request.
This is built by generated dispatchers after the inbound payload has been
deserialized into the method’s typed argument tuple. The tuple is then
exposed reflectively through Peek, allowing middleware to inspect the
decoded request without re-deserializing it.
Because this is a borrowed reflective view, middleware should extract any owned data it needs before awaiting. The view itself is intended for synchronous inspection within the hook body.
Implementations§
Source§impl<'a> ServerRequest<'a>
impl<'a> ServerRequest<'a>
Sourcepub const fn new(context: RequestContext<'a>, args: Peek<'a, 'static>) -> Self
pub const fn new(context: RequestContext<'a>, args: Peek<'a, 'static>) -> Self
Create a new middleware request view from a request context and decoded args.
Sourcepub const fn context(&self) -> &RequestContext<'a>
pub const fn context(&self) -> &RequestContext<'a>
Borrowed per-request context for this call.
Sourcepub fn method(&self) -> &'static MethodDescriptor
pub fn method(&self) -> &'static MethodDescriptor
Static descriptor for the method being handled.
Sourcepub fn metadata(&self) -> &'a [MetadataEntry<'static>]
pub fn metadata(&self) -> &'a [MetadataEntry<'static>]
Request metadata borrowed from the inbound call.
Sourcepub fn request_id(&self) -> Option<RequestId>
pub fn request_id(&self) -> Option<RequestId>
Wire-level request identifier for this call, when available.
Sourcepub fn connection_id(&self) -> Option<ConnectionId>
pub fn connection_id(&self) -> Option<ConnectionId>
Virtual connection identifier for this call, when available.
Sourcepub fn extensions(&self) -> &'a Extensions
pub fn extensions(&self) -> &'a Extensions
Per-request middleware extensions bag.
Trait Implementations§
Source§impl<'a> Clone for ServerRequest<'a>
impl<'a> Clone for ServerRequest<'a>
Source§fn clone(&self) -> ServerRequest<'a>
fn clone(&self) -> ServerRequest<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more