pub struct ScopedServiceManager { /* private fields */ }
Expand description
Scoped service manager for managing services within a specific scope
Implementations§
Source§impl ScopedServiceManager
impl ScopedServiceManager
Sourcepub fn create_child(parent: Arc<Self>) -> Self
pub fn create_child(parent: Arc<Self>) -> Self
Create a child scope with this scope as parent This requires the parent to be wrapped in an Arc
Sourcepub fn add_service<T>(&self, service: T)
pub fn add_service<T>(&self, service: T)
Add a service to this scope
Sourcepub fn add_arc_service<T>(&self, service: Arc<T>)
pub fn add_arc_service<T>(&self, service: Arc<T>)
Store a service as Arc in this scope
Sourcepub fn get_arc_service<T>(&self) -> Option<Arc<T>>
pub fn get_arc_service<T>(&self) -> Option<Arc<T>>
Get a service from this scope, checking parent scopes if not found
Services must be stored as Arc
Sourcepub fn has_service<T>(&self) -> bool
pub fn has_service<T>(&self) -> bool
Check if a service exists in this scope or parent scopes
Sourcepub fn has_service_local<T>(&self) -> bool
pub fn has_service_local<T>(&self) -> bool
Check if a service exists in this specific scope (not parent scopes)
Sourcepub fn service_count(&self) -> usize
pub fn service_count(&self) -> usize
Get the number of services in this scope
Sourcepub fn parent(&self) -> Option<&Arc<ScopedServiceManager>>
pub fn parent(&self) -> Option<&Arc<ScopedServiceManager>>
Get parent scope
Trait Implementations§
Source§impl Debug for ScopedServiceManager
impl Debug for ScopedServiceManager
Auto Trait Implementations§
impl !Freeze for ScopedServiceManager
impl RefUnwindSafe for ScopedServiceManager
impl Send for ScopedServiceManager
impl Sync for ScopedServiceManager
impl Unpin for ScopedServiceManager
impl UnwindSafe for ScopedServiceManager
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