pub struct Scope { /* private fields */ }Expand description
A unit of work with its own scoped instances, such as one request.
Owns a handle to the container, so it can be moved into other threads or tasks and keeps working after the provider that created it is dropped.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn resolve<T: ?Sized + Send + Sync + 'static>(
&self,
) -> Result<Arc<T>, ResolveError>
pub fn resolve<T: ?Sized + Send + Sync + 'static>( &self, ) -> Result<Arc<T>, ResolveError>
Resolves a service of any lifetime.
When T is registered more than once, the last registration wins; use
resolve_all for every one.
Sourcepub fn resolve_all<T: ?Sized + Send + Sync + 'static>(
&self,
) -> Result<Vec<Arc<T>>, ResolveError>
pub fn resolve_all<T: ?Sized + Send + Sync + 'static>( &self, ) -> Result<Vec<Arc<T>>, ResolveError>
Resolves every registration of T, in registration order.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Scope
impl !RefUnwindSafe for Scope
impl !UnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scope
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