FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    ServiceDescriptor

    struct · ferroui-dependency-injection · v0.5.0

    struct ServiceDescriptor
    

    A registration. Construct typed factories with new or from_factory; erased registration exists for adapters. Instance registrations are externally owned and never disposed.

    View source

    Members

    new

    fn new<S: ?Sized + 'static, F>(lifetime: ServiceLifetime, factory: F) -> Self
    where F: Fn(&ServiceProvider) -> ServiceResult<Rc<S>> + 'static
    

    Source

    keyed

    fn keyed<S: ?Sized + 'static, F>(lifetime: ServiceLifetime, key: Option<ServiceKey>, factory: F) -> Self
    where F: Fn(&ServiceProvider, Option<&ServiceKey>) -> ServiceResult<Rc<S>> + 'static
    

    Source

    from_erased

    fn from_erased(identifier: ServiceIdentifier, lifetime: ServiceLifetime, factory: impl Fn(&ServiceProvider, Option<&ServiceKey>) -> ServiceResult<ErasedService> + 'static) -> Self
    

    Source

    instance

    fn instance<S: ?Sized + 'static>(value: Rc<S>) -> Self
    

    Source

    enumerable_instance

    fn enumerable_instance<S: ?Sized + 'static>(values: Vec<Rc<S>>) -> Self
    

    Explicit enumerable registration overrides the collection synthesized from individual services.

    Source

    from_factory

    fn from_factory<S: ?Sized + 'static>(lifetime: ServiceLifetime, factory: ObjectFactory<S>) -> Self
    

    Source

    with_key

    fn with_key(self: Self, key: Option<ServiceKey>) -> Self
    

    Source

    with_dependencies

    fn with_dependencies(self: Self, dependencies: Vec<Dependency>) -> Self
    

    Source

    with_implementation

    fn with_implementation<I: ?Sized + 'static>(self: Self) -> Self
    

    Identity used by TryAddEnumerable to distinguish implementations of the same service.

    Source

    with_disposal

    fn with_disposal<S: ?Sized + IDisposable + 'static>(self: Self) -> Self
    

    Source

    with_async_disposal

    fn with_async_disposal<S: ?Sized + IAsyncDisposable + 'static>(self: Self) -> Self
    

    Source

    on_dispose

    fn on_dispose<S: ?Sized + 'static>(self: Self, dispose: impl Fn(&S) -> () + 'static) -> Self
    

    Source

    on_dispose_async

    fn on_dispose_async<S: ?Sized + 'static>(self: Self, dispose: impl Fn(Rc<S>) -> DisposeTask + 'static) -> Self
    

    Source

    implementation_type

    fn implementation_type(self: &Self) -> Option<ServiceType>
    

    Source

    implementation_instance

    fn implementation_instance(self: &Self) -> Option<ErasedService>
    

    Source

    implementation_factory

    fn implementation_factory(self: &Self) -> Option<crate::service_descriptor::ErasedFactory>
    

    Source

    service_type

    fn service_type(self: &Self) -> ServiceType
    

    Source

    service_key

    fn service_key(self: &Self) -> Option<&ServiceKey>
    

    Source

    lifetime

    fn lifetime(self: &Self) -> ServiceLifetime
    

    Source

    is_keyed_service

    fn is_keyed_service(self: &Self) -> bool
    

    Source

    dependencies

    fn dependencies(self: &Self) -> &[Dependency]
    

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ToString
    • Clone
    • Debug
    • Display

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.