pub struct Dep<T>(pub T);Expand description
Newtype wrapper used in #[handler] function signatures to declare a
handler dependency.
When the macros feature is enabled and a handler function accepts
parameters of the form Dep(name): Dep<MyType>, the generated descriptor
will resolve MyType from Deps at build time and inject it into the
handler.
You can also use Dep<T> in manual HandlerDescriptor implementations to
make the injection contract explicit:
use jaeb::{Dep, Deps};
use std::sync::Arc;
struct Mailer;
fn uses_dep(dep: Dep<Arc<Mailer>>) {
let _mailer: &Arc<Mailer> = &*dep;
}Tuple Fields§
§0: TTrait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Dep<T>where
T: Freeze,
impl<T> RefUnwindSafe for Dep<T>where
T: RefUnwindSafe,
impl<T> Send for Dep<T>where
T: Send,
impl<T> Sync for Dep<T>where
T: Sync,
impl<T> Unpin for Dep<T>where
T: Unpin,
impl<T> UnsafeUnpin for Dep<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Dep<T>where
T: UnwindSafe,
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, A> DynAccess<T> for A
impl<T, A> DynAccess<T> for A
Source§fn load(&self) -> DynGuard<T>
fn load(&self) -> DynGuard<T>
The equivalent of
Access::load.