Struct ModuleBuilder

Source
pub struct ModuleBuilder<M: Module> { /* private fields */ }
Expand description

Builds a Module. Component parameters can be set, and both components and providers implementations can be overridden.

Implementations§

Source§

impl<M: Module> ModuleBuilder<M>

Source

pub fn with_submodules(submodules: M::Submodules) -> Self

Create a ModuleBuilder by providing the module’s submodules.

Source

pub fn with_component_parameters<C: Component<M>>( self, params: C::Parameters, ) -> Self
where M: HasComponent<C::Interface>,

Set the parameters of the specified component. If the parameters are not manually set, the defaults will be used.

Source

pub fn with_component_override<I: Interface + ?Sized>( self, component: Box<I>, ) -> Self
where M: HasComponent<I>,

Override a component implementation. This method is best used when the overriding component has no injected dependencies.

Source

pub fn with_component_override_fn<I: Interface + ?Sized>( self, component_fn: ComponentFn<M, I>, ) -> Self
where M: HasComponent<I>,

Override a component implementation. This method is best used when the overriding component has injected dependencies.

Source

pub fn with_provider_override<I: 'static + ?Sized>( self, provider_fn: ProviderFn<M, I>, ) -> Self
where M: HasProvider<I>,

Override a provider implementation.

Source

pub fn build(self) -> M

Build the module

Auto Trait Implementations§

§

impl<M> Freeze for ModuleBuilder<M>
where <M as Module>::Submodules: Freeze,

§

impl<M> !RefUnwindSafe for ModuleBuilder<M>

§

impl<M> Send for ModuleBuilder<M>
where <M as Module>::Submodules: Send,

§

impl<M> !Sync for ModuleBuilder<M>

§

impl<M> Unpin for ModuleBuilder<M>
where <M as Module>::Submodules: Unpin, M: Unpin,

§

impl<M> !UnwindSafe for ModuleBuilder<M>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> Any for T
where T: Any,