ServiceCollection
struct · ferroui-dependency-injection · v0.5.0
struct ServiceCollection
Ordered registrations; building a provider snapshots this collection.
Members
newdescriptorslenis_emptyis_read_onlymake_read_onlyaddadd_sequenceinsertremove_atcleartry_addtry_add_enumerablereplaceremove_allremove_all_keyeditercontainsindex_ofremovecopy_tobuild_service_provideradd_singleton_instanceadd_keyed_singleton_instanceadd_singletonadd_keyed_singletonadd_scopedadd_keyed_scopedadd_transientadd_keyed_transient
new
fn new() -> Self
descriptors
fn descriptors(self: &Self) -> &[ServiceDescriptor]
len
fn len(self: &Self) -> usize
is_empty
fn is_empty(self: &Self) -> bool
is_read_only
fn is_read_only(self: &Self) -> bool
make_read_only
fn make_read_only(self: &mut Self)
add
fn add(self: &mut Self, descriptor: ServiceDescriptor) -> &mut Self
add_sequence
fn add_sequence(self: &mut Self, descriptors: impl IntoIterator<Item = ServiceDescriptor>) -> &mut Self
insert
fn insert(self: &mut Self, index: usize, descriptor: ServiceDescriptor)
remove_at
fn remove_at(self: &mut Self, index: usize) -> ServiceDescriptor
clear
fn clear(self: &mut Self)
try_add
fn try_add(self: &mut Self, descriptor: ServiceDescriptor) -> &mut Self
try_add_enumerable
fn try_add_enumerable(self: &mut Self, descriptor: ServiceDescriptor) -> &mut Self
replace
fn replace(self: &mut Self, descriptor: ServiceDescriptor) -> &mut Self
Removes the first matching registration, then appends the replacement, as upstream.
remove_all
fn remove_all<S: ?Sized + 'static>(self: &mut Self) -> &mut Self
remove_all_keyed
fn remove_all_keyed<S: ?Sized + 'static>(self: &mut Self, key: Option<ServiceKey>) -> &mut Self
iter
fn iter(self: &Self) -> std::slice::Iter<'_, ServiceDescriptor>
contains
fn contains(self: &Self, descriptor: &ServiceDescriptor) -> bool
index_of
fn index_of(self: &Self, descriptor: &ServiceDescriptor) -> Option<usize>
remove
fn remove(self: &mut Self, descriptor: &ServiceDescriptor) -> bool
copy_to
fn copy_to(self: &Self, target: &mut [ServiceDescriptor], index: usize)
build_service_provider
fn build_service_provider(self: &Self, options: ServiceProviderOptions) -> ServiceResult<ServiceProvider>
add_singleton_instance
fn add_singleton_instance<S: ?Sized + 'static>(self: &mut Self, value: Rc<S>) -> &mut Self
add_keyed_singleton_instance
fn add_keyed_singleton_instance<S: ?Sized + 'static>(self: &mut Self, key: Option<ServiceKey>, value: Rc<S>) -> &mut Self
add_singleton
fn add_singleton<S: ?Sized + 'static, F>(self: &mut Self, factory: F) -> &mut Self
where F: Fn(&ServiceProvider) -> ServiceResult<Rc<S>> + 'static
add_keyed_singleton
fn add_keyed_singleton<S: ?Sized + 'static, F>(self: &mut Self, key: Option<ServiceKey>, factory: F) -> &mut Self
where F: Fn(&ServiceProvider, Option<&ServiceKey>) -> ServiceResult<Rc<S>> + 'static
add_scoped
fn add_scoped<S: ?Sized + 'static, F>(self: &mut Self, factory: F) -> &mut Self
where F: Fn(&ServiceProvider) -> ServiceResult<Rc<S>> + 'static
add_keyed_scoped
fn add_keyed_scoped<S: ?Sized + 'static, F>(self: &mut Self, key: Option<ServiceKey>, factory: F) -> &mut Self
where F: Fn(&ServiceProvider, Option<&ServiceKey>) -> ServiceResult<Rc<S>> + 'static
add_transient
fn add_transient<S: ?Sized + 'static, F>(self: &mut Self, factory: F) -> &mut Self
where F: Fn(&ServiceProvider) -> ServiceResult<Rc<S>> + 'static
add_keyed_transient
fn add_keyed_transient<S: ?Sized + 'static, F>(self: &mut Self, key: Option<ServiceKey>, factory: F) -> &mut Self
where F: Fn(&ServiceProvider, Option<&ServiceKey>) -> ServiceResult<Rc<S>> + 'static
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedIServiceProviderFactory<ServiceCollection>CloneDefaultIServiceCollectionIndex<usize>IndexMut<usize>IntoIterator
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.