pub struct Read<P: Key> { /* private fields */ }
Expand description
Middleware for data that persists between Requests with read-only capabilities.
The data is stored behind an Arc, so multiple threads can have concurrent, non-blocking access.
Read
can be linked as BeforeMiddleware
to add data to the Request
extensions and it can be linked as an AfterMiddleware
to add data to
the Response
extensions.
Read
also implements Plugin
, so the data stored within can be
accessed through request.get::<Read<P>>()
as an Arc<P::Value>
.
Implementations§
Trait Implementations§
Source§impl<P: Key> AfterMiddleware for Read<P>
impl<P: Key> AfterMiddleware for Read<P>
Source§impl<P: Key> BeforeMiddleware for Read<P>
impl<P: Key> BeforeMiddleware for Read<P>
Auto Trait Implementations§
impl<P> Freeze for Read<P>
impl<P> RefUnwindSafe for Read<P>
impl<P> Send for Read<P>
impl<P> Sync for Read<P>
impl<P> Unpin for Read<P>
impl<P> UnwindSafe for Read<P>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> PersistentInto<Arc<Mutex<T>>> for T
impl<T> PersistentInto<Arc<Mutex<T>>> for T
Source§fn persistent_into(self) -> Arc<Mutex<T>>
fn persistent_into(self) -> Arc<Mutex<T>>
Convert
self
into a value of type T
.Source§impl<T> PersistentInto<Arc<RwLock<T>>> for T
impl<T> PersistentInto<Arc<RwLock<T>>> for T
Source§fn persistent_into(self) -> Arc<RwLock<T>>
fn persistent_into(self) -> Arc<RwLock<T>>
Convert
self
into a value of type T
.Source§impl<T> PersistentInto<Arc<T>> for T
impl<T> PersistentInto<Arc<T>> for T
Source§fn persistent_into(self) -> Arc<T>
fn persistent_into(self) -> Arc<T>
Convert
self
into a value of type T
.Source§impl<T> PersistentInto<T> for T
impl<T> PersistentInto<T> for T
Source§fn persistent_into(self) -> T
fn persistent_into(self) -> T
Convert
self
into a value of type T
.