pub struct Config<T>(pub Arc<T>);Expand description
One section of this request’s configuration.
async fn handler(db: Config<Database>) -> String {
db.host.clone()
}Extracting the same type twice in one handler answers the same Arc.
Extracting one the middleware was not given answers 500 — see
SnapshotMissing.
Tuple Fields§
§0: Arc<T>Trait Implementations§
Source§impl<T> FromRequest for Config<T>
impl<T> FromRequest for Config<T>
Source§fn from_request(request: &HttpRequest, _payload: &mut Payload) -> Self::Future
fn from_request(request: &HttpRequest, _payload: &mut Payload) -> Self::Future
Create a
Self from request parts asynchronously.Auto Trait Implementations§
impl<T> Freeze for Config<T>
impl<T> RefUnwindSafe for Config<T>where
T: RefUnwindSafe,
impl<T> Send for Config<T>
impl<T> Sync for Config<T>
impl<T> Unpin for Config<T>
impl<T> UnsafeUnpin for Config<T>
impl<T> UnwindSafe for Config<T>where
T: RefUnwindSafe,
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