pub struct RequestScope { /* private fields */ }Expand description
Owns the request body and extracted data for a single pipeline invocation.
App-level state lives in a shared Arc<Extensions> (zero-copy per request).
Per-request data (path params, hook insertions) goes into a local Extensions
that starts empty and allocates only on first insert.
Implementations§
Source§impl RequestScope
impl RequestScope
pub fn new(body: Body, body_limit: usize) -> RequestScope
pub fn take_body(&mut self) -> Option<Body>
pub fn body_limit(&self) -> usize
Sourcepub fn get<T>(&self) -> Option<&T>
pub fn get<T>(&self) -> Option<&T>
Returns a shared reference to T.
Checks local (per-request) extensions first, then shared (app) state.
Sourcepub fn get_mut<T>(&mut self) -> Option<&mut T>
pub fn get_mut<T>(&mut self) -> Option<&mut T>
Returns a mutable reference to T from local (per-request) extensions only.
Auto Trait Implementations§
impl Freeze for RequestScope
impl !RefUnwindSafe for RequestScope
impl Send for RequestScope
impl !Sync for RequestScope
impl Unpin for RequestScope
impl UnsafeUnpin for RequestScope
impl !UnwindSafe for RequestScope
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