Struct runtime_injector::Arg [−][src]
Expand description
Allows custom pre-defined values to be passed as arguments to services.
Example
use runtime_injector::{Arg, Injector, IntoTransient, WithArg}; struct Foo(Arg<i32>); let mut builder = Injector::builder(); builder.provide(Foo.transient()); builder.with_arg::<Foo, i32>(12); let injector = builder.build(); let foo: Box<Foo> = injector.get().unwrap(); assert_eq!(12, *foo.0);
Implementations
impl<T: Service + AsAny + Clone> Arg<T>
[src]
impl<T: Service + AsAny + Clone> Arg<T>
[src]pub fn into_inner(arg: Self) -> T
[src]
pub fn into_inner(arg: Self) -> T
[src]Converts an argument into its inner value.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Arg<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Arg<T>
impl<T> Sync for Arg<T>
impl<T> Unpin for Arg<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Arg<T> where
T: UnwindSafe,
T: UnwindSafe,