Struct dill::CatalogBuilder
source · pub struct CatalogBuilder { /* private fields */ }Implementations§
source§impl CatalogBuilder
impl CatalogBuilder
pub fn new() -> Self
pub fn new_chained(chained_catalog: &Catalog) -> Self
sourcepub fn add<C: Component>(&mut self) -> &mut Self
pub fn add<C: Component>(&mut self) -> &mut Self
Registers a component using its associated builder.
Note that unline CatalogBuilder::add_builder() this will also bind the implementation to component’s default interfaces.
pub fn add_builder<Bld, Impl>(&mut self, builder: Bld) -> &mut Self
pub fn add_value<Impl>(&mut self, value: Impl) -> &mut Self
sourcepub fn add_value_lazy<Fct, Impl>(&mut self, factory: Fct) -> &mut Self
pub fn add_value_lazy<Fct, Impl>(&mut self, factory: Fct) -> &mut Self
Uses the provided factory once and caches the instance in a Singleton scope
pub fn bind<Iface, Impl>(&mut self) -> &mut Self
pub fn build(&mut self) -> Catalog
sourcepub fn validate(&mut self) -> Result<(), ValidationError>
pub fn validate(&mut self) -> Result<(), ValidationError>
Validates the dependency graph returning a combined error.
In case some of your types are registered dynamically you can ValidationErrorExt::ignore() method which is implemented on the Result type (you need to import the trait).
Example:
use dill::*;
trait MyDynamicType {}
let mut b = CatalogBuilder::new();
// Populate the builder
b.validate()
.ignore::<dyn MyDynamicType>()
.unwrap();Trait Implementations§
source§impl Clone for CatalogBuilder
impl Clone for CatalogBuilder
source§fn clone(&self) -> CatalogBuilder
fn clone(&self) -> CatalogBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CatalogBuilder
impl !RefUnwindSafe for CatalogBuilder
impl Send for CatalogBuilder
impl Sync for CatalogBuilder
impl Unpin for CatalogBuilder
impl !UnwindSafe for CatalogBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)