pub struct ServiceCollection { /* private fields */ }Expand description
Ordered registrations; building a provider snapshots this collection.
Implementations§
Source§impl ServiceCollection
impl ServiceCollection
pub fn new() -> Self
pub fn descriptors(&self) -> &[ServiceDescriptor]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_read_only(&self) -> bool
pub fn make_read_only(&mut self)
pub fn add(&mut self, descriptor: ServiceDescriptor) -> &mut Self
pub fn add_sequence( &mut self, descriptors: impl IntoIterator<Item = ServiceDescriptor>, ) -> &mut Self
pub fn insert(&mut self, index: usize, descriptor: ServiceDescriptor)
pub fn remove_at(&mut self, index: usize) -> ServiceDescriptor
pub fn clear(&mut self)
pub fn try_add(&mut self, descriptor: ServiceDescriptor) -> &mut Self
pub fn try_add_enumerable(&mut self, descriptor: ServiceDescriptor) -> &mut Self
Sourcepub fn replace(&mut self, descriptor: ServiceDescriptor) -> &mut Self
pub fn replace(&mut self, descriptor: ServiceDescriptor) -> &mut Self
Removes the first matching registration, then appends the replacement, as upstream.
pub fn remove_all<S: ?Sized + 'static>(&mut self) -> &mut Self
pub fn remove_all_keyed<S: ?Sized + 'static>( &mut self, key: Option<ServiceKey>, ) -> &mut Self
pub fn iter(&self) -> Iter<'_, ServiceDescriptor> ⓘ
pub fn contains(&self, descriptor: &ServiceDescriptor) -> bool
pub fn index_of(&self, descriptor: &ServiceDescriptor) -> Option<usize>
pub fn remove(&mut self, descriptor: &ServiceDescriptor) -> bool
pub fn copy_to(&self, target: &mut [ServiceDescriptor], index: usize)
pub fn build_service_provider( &self, options: ServiceProviderOptions, ) -> ServiceResult<ServiceProvider>
pub fn add_singleton_instance<S: ?Sized + 'static>( &mut self, value: Rc<S>, ) -> &mut Self
pub fn add_keyed_singleton_instance<S: ?Sized + 'static>( &mut self, key: Option<ServiceKey>, value: Rc<S>, ) -> &mut Self
Source§impl ServiceCollection
impl ServiceCollection
pub fn add_singleton<S: ?Sized + 'static, F>(&mut self, factory: F) -> &mut Self
pub fn add_keyed_singleton<S: ?Sized + 'static, F>( &mut self, key: Option<ServiceKey>, factory: F, ) -> &mut Self
Source§impl ServiceCollection
impl ServiceCollection
pub fn add_scoped<S: ?Sized + 'static, F>(&mut self, factory: F) -> &mut Self
pub fn add_keyed_scoped<S: ?Sized + 'static, F>( &mut self, key: Option<ServiceKey>, factory: F, ) -> &mut Self
Source§impl ServiceCollection
impl ServiceCollection
pub fn add_transient<S: ?Sized + 'static, F>(&mut self, factory: F) -> &mut Self
pub fn add_keyed_transient<S: ?Sized + 'static, F>( &mut self, key: Option<ServiceKey>, factory: F, ) -> &mut Self
Trait Implementations§
Source§impl Clone for ServiceCollection
impl Clone for ServiceCollection
Source§impl Default for ServiceCollection
impl Default for ServiceCollection
Source§impl IServiceCollection for ServiceCollection
impl IServiceCollection for ServiceCollection
fn descriptors(&self) -> &[ServiceDescriptor]
fn add(&mut self, descriptor: ServiceDescriptor) -> &mut Self
Source§impl IServiceProviderFactory<ServiceCollection> for DefaultServiceProviderFactory
impl IServiceProviderFactory<ServiceCollection> for DefaultServiceProviderFactory
fn create_builder(&self, services: ServiceCollection) -> ServiceCollection
fn create_service_provider( &self, builder: ServiceCollection, ) -> ServiceResult<ServiceProvider>
Source§impl Index<usize> for ServiceCollection
impl Index<usize> for ServiceCollection
Source§impl IndexMut<usize> for ServiceCollection
impl IndexMut<usize> for ServiceCollection
Source§impl<'a> IntoIterator for &'a ServiceCollection
impl<'a> IntoIterator for &'a ServiceCollection
Auto Trait Implementations§
impl !RefUnwindSafe for ServiceCollection
impl !Send for ServiceCollection
impl !Sync for ServiceCollection
impl !UnwindSafe for ServiceCollection
impl Freeze for ServiceCollection
impl Unpin for ServiceCollection
impl UnsafeUnpin for ServiceCollection
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