pub struct RequestScope<'a> { /* 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<'a> RequestScope<'a>
impl<'a> RequestScope<'a>
pub fn new(shared: &'a Extensions, body: Body, body_limit: usize) -> Self
pub fn take_body(&mut self) -> Option<Body>
pub fn body_limit(&self) -> usize
Sourcepub fn get<T: Send + Sync + 'static>(&self) -> Option<&T>
pub fn get<T: Send + Sync + 'static>(&self) -> Option<&T>
Returns a shared reference to T.
Checks local (per-request) extensions first, then shared (app) state.
Sourcepub fn get_mut<T: Send + Sync + 'static>(&mut self) -> Option<&mut T>
pub fn get_mut<T: Send + Sync + 'static>(&mut self) -> Option<&mut T>
Returns a mutable reference to T from local (per-request) extensions only.
Auto Trait Implementations§
impl<'a> Freeze for RequestScope<'a>
impl<'a> !RefUnwindSafe for RequestScope<'a>
impl<'a> Send for RequestScope<'a>
impl<'a> !Sync for RequestScope<'a>
impl<'a> Unpin for RequestScope<'a>
impl<'a> UnsafeUnpin for RequestScope<'a>
impl<'a> !UnwindSafe for RequestScope<'a>
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