Skip to main content

MadsBuilder

Struct MadsBuilder 

Source
pub struct MadsBuilder { /* private fields */ }
Expand description

Builds an application by explicitly providing and constructing providers.

Implementations§

Source§

impl MadsBuilder

Source

pub fn new(config: Config) -> Self

Creates a builder with configuration available to provider constructors and resolvers.

Source

pub fn root<M: Module>(&mut self) -> Result<&mut Self>

Selects the root module for scoped analysis and construction.

Source

pub fn provide<T>(&mut self, value: T) -> Result<&mut Self>
where T: Send + Sync + 'static,

Provides a concrete application-scoped value.

Source

pub async fn construct<T>(&mut self) -> Result<&mut Self>
where T: Send + Sync + 'static,

Constructs exactly one statically declared provider using currently provided dependencies.

Source

pub fn analyze(&self) -> GraphAnalysis

Analyzes the complete provider graph without invoking constructors.

Source

pub fn lifecycle_hook<H>(&mut self, hook: H) -> &mut Self
where H: LifecycleHook + 'static,

Registers a hook that runs when the completed application starts and stops.

Source

pub async fn build(self) -> Result<Mads>

Validates and automatically constructs the complete application graph.

Auto Trait Implementations§

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.