RegistrationHelper
struct · ferroui-base · v0.5.0
struct RegistrationHelper<'a, T: ?Sized + 'static>
Binds the service type T to an implementation; see
FerroLocator::bind.
Members
to_constant
fn to_constant(self: Self, constant: Rc<T>) -> &'a FerroLocator
Every lookup returns constant.
to_func
fn to_func(self: Self, func: impl Fn() -> Option<Rc<T>> + 'static) -> &'a FerroLocator
Every lookup calls func.
to_lazy
fn to_lazy(self: Self, func: impl Fn() -> Option<Rc<T>> + 'static) -> &'a FerroLocator
The first lookup calls func; later lookups return what it produced.
to_singleton
fn to_singleton<TImpl: Default + 'static>(self: Self, upcast: fn(Rc<TImpl>) -> Rc<T>) -> &'a FerroLocator
The first lookup creates a TImpl, which every lookup then returns.
upcast converts the implementation handle to the service handle;
for a trait object service it is the identity closure
|instance| instance, which performs the unsizing coercion.
to_transient
fn to_transient<TImpl: Default + 'static>(self: Self, upcast: fn(Rc<TImpl>) -> Rc<T>) -> &'a FerroLocator
Every lookup creates a new TImpl. See
to_singleton for upcast.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.