Skip to main content

FactoryProvision

Struct FactoryProvision 

Source
pub struct FactoryProvision<C: Capability, E> { /* private fields */ }
Expand description

A capability provision built on demand, for values whose construction can fail.

The factory runs only if FrozenProcess::resolve_with selects this module.

Implementations§

Source§

impl<C: Capability, E> FactoryProvision<C, E>

Source

pub fn new( module: ModuleId, factory: impl FnOnce() -> Result<Arc<C::Value>, E> + 'static, ) -> Self

Associates a module identity with a factory for capability C.

Source

pub const fn module(&self) -> ModuleId

Returns the module identity associated with this provision.

Auto Trait Implementations§

§

impl<C, E> !RefUnwindSafe for FactoryProvision<C, E>

§

impl<C, E> !Send for FactoryProvision<C, E>

§

impl<C, E> !Sync for FactoryProvision<C, E>

§

impl<C, E> !UnwindSafe for FactoryProvision<C, E>

§

impl<C, E> Freeze for FactoryProvision<C, E>
where Box<dyn FnOnce() -> Result<Arc<<C as Capability>::Value>, E>>: Freeze,

§

impl<C, E> Unpin for FactoryProvision<C, E>
where Box<dyn FnOnce() -> Result<Arc<<C as Capability>::Value>, E>>: Unpin,

§

impl<C, E> UnsafeUnpin for FactoryProvision<C, E>
where Box<dyn FnOnce() -> Result<Arc<<C as Capability>::Value>, E>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.