#[non_exhaustive]pub struct RequestContext<Context: ServerContext> {
pub server: Arc<DropshotState<Context>>,
pub endpoint: RequestEndpointMetadata,
pub request_id: String,
pub log: Logger,
pub request: RequestInfo,
}
Expand description
Handle for various interfaces useful during request processing.
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.server: Arc<DropshotState<Context>>
shared server state
endpoint: RequestEndpointMetadata
Endpoint-specific information.
request_id: String
unique id assigned to this request
log: Logger
logger for this specific request
request: RequestInfo
basic request information (method, URI, etc.)
Implementations§
Source§impl<Context: ServerContext> RequestContext<Context>
impl<Context: ServerContext> RequestContext<Context>
Sourcepub fn request_body_max_bytes(&self) -> usize
pub fn request_body_max_bytes(&self) -> usize
Returns the maximum request body size.
This is typically the same as
self.server.config.request_body_max_bytes
, but can be overridden on a
per-endpoint basis.
Sourcepub fn page_limit<ScanParams, PageSelector>(
&self,
pag_params: &PaginationParams<ScanParams, PageSelector>,
) -> Result<NonZeroU32, HttpError>
pub fn page_limit<ScanParams, PageSelector>( &self, pag_params: &PaginationParams<ScanParams, PageSelector>, ) -> Result<NonZeroU32, HttpError>
Returns the appropriate count of items to return for a paginated request
This first looks at any client-requested limit and clamps it based on the server-configured maximum page size. If the client did not request any particular limit, this function returns the server-configured default page size.
Trait Implementations§
Source§impl<Context: Debug + ServerContext> Debug for RequestContext<Context>
impl<Context: Debug + ServerContext> Debug for RequestContext<Context>
Source§impl<T: 'static + ServerContext> RequestContextArgument for RequestContext<T>
impl<T: 'static + ServerContext> RequestContextArgument for RequestContext<T>
Auto Trait Implementations§
impl<Context> !Freeze for RequestContext<Context>
impl<Context> !RefUnwindSafe for RequestContext<Context>
impl<Context> Send for RequestContext<Context>
impl<Context> Sync for RequestContext<Context>
impl<Context> Unpin for RequestContext<Context>
impl<Context> !UnwindSafe for RequestContext<Context>
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