ferroui_dependency_injection
module · ferroui-dependency-injection · v0.5.0
module ferroui_dependency_injection
A UI-independent, thread-local port of Microsoft.Extensions.DependencyInjection.
Services (including trait objects) are identified by TypeId and returned as Rc<S>.
Collections are mutable; built providers are immutable snapshots. Dispose providers and
scopes explicitly. Constructor factories declare dependencies for build-time validation;
arbitrary closures are opaque, as delegate factories are upstream.
use ferroui_dependency_injection::*;
use std::rc::Rc;
let mut services = ServiceCollection::new();
services.add_singleton::<String, _>(|_| Ok(Rc::new("hello".into())));
let provider = services.build_service_provider(Default::default())?;
assert_eq!(&*provider.get_required_service::<String>()?, "hello");
provider.dispose()?;
## Ok::<(), ServiceError>(())
Contents
service_factory— macroObjectFactory— structActivatorUtilities— structIServiceProviderFactory— traitDefaultServiceProviderFactory— structServiceCollection— structIServiceCollection— traitDisposeTask— type aliasIAsyncDisposable— traitServiceKeyLookupMode— enumDependencyKind— enumDependency— structErasedFactory— type aliasServiceDescriptor— structServiceProviderOptions— structIServiceProvider— traitISupportRequiredService— traitIKeyedServiceProvider— traitIServiceProviderIsService— traitIServiceProviderIsKeyedService— traitIServiceScopeFactory— traitIServiceScope— traitServiceProviderServiceExtensions— traitServiceProvider— structServiceScope— structAsyncServiceScope— structServiceLifetime— enumServiceType— structServiceKey— structServiceIdentifier— structErasedService— type aliaserase_service— functionunerase_service— functionServiceResult— type aliasServiceError— enum
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.