pub struct Resolver { /* private fields */ }Expand description
Resolves providers with the visibility of one module: its own providers, the exports of the modules it imports and the exports of global modules.
Every provider constructor receives a Resolver for the module that owns
the provider. It carries the optional RequestScope and the resolution
stack used to detect cycles and scope inversions at runtime.
Implementations§
Source§impl Resolver
impl Resolver
Sourcepub async fn get<T: ?Sized + Send + Sync + 'static>(
&self,
) -> Result<Arc<T>, KernelError>
pub async fn get<T: ?Sized + Send + Sync + 'static>( &self, ) -> Result<Arc<T>, KernelError>
Resolves the unnamed provider of T.
Sourcepub async fn get_named<T: ?Sized + Send + Sync + 'static>(
&self,
name: &str,
) -> Result<Arc<T>, KernelError>
pub async fn get_named<T: ?Sized + Send + Sync + 'static>( &self, name: &str, ) -> Result<Arc<T>, KernelError>
Resolves the provider of T registered under name.
Sourcepub async fn get_all<T: ?Sized + Send + Sync + 'static>(
&self,
) -> Result<Vec<Arc<T>>, KernelError>
pub async fn get_all<T: ?Sized + Send + Sync + 'static>( &self, ) -> Result<Vec<Arc<T>>, KernelError>
Resolves every multi-binding of T in the app (see
ModuleBuilder::multi), in module dependency order.
Sourcepub fn lazy<T: ?Sized + Send + Sync + 'static>(&self) -> Lazy<T>
pub fn lazy<T: ?Sized + Send + Sync + 'static>(&self) -> Lazy<T>
A handle that resolves the unnamed provider of T on its first
get. It adds no edge to the dependency graph, so it
breaks cycles; resolve it after boot, not inside a constructor.
Sourcepub fn app(&self) -> AppContext
pub fn app(&self) -> AppContext
A handle to the whole app.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Resolver
impl !UnwindSafe for Resolver
impl Forget for Resolver
impl Freeze for Resolver
impl Send for Resolver
impl Sync for Resolver
impl Unpin for Resolver
impl UnsafeUnpin for Resolver
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