dill

Struct TypecastBuilder

Source
pub struct TypecastBuilder<'a, Iface>
where Iface: 'static + ?Sized,
{ /* private fields */ }
Expand description

Takes a dynamic Builder and casts the instance to desired interface

Implementations§

Source§

impl<'a, Iface> TypecastBuilder<'a, Iface>
where Iface: 'static + ?Sized,

Source

pub fn get(&self, cat: &Catalog) -> Result<Arc<Iface>, InjectionError>

Trait Implementations§

Source§

impl<'a, Iface> Builder for TypecastBuilder<'a, Iface>
where Iface: 'static + ?Sized,

Source§

fn instance_type_id(&self) -> TypeId

TypeId of the type that this builder supplies
Source§

fn instance_type_name(&self) -> &'static str

Name of the type that this builder supplies in the mod1::mod2::Typ format
Source§

fn interfaces(&self, clb: &mut dyn FnMut(&InterfaceDesc) -> bool)

Lists interfaces that the supplied type supports. Avoid using this low-level method directly - use BuilderExt convenience methods instead.
Source§

fn metadata<'b, 'c>(&'b self, clb: &'c mut dyn FnMut(&'b dyn Any) -> bool)

Provider interface for accessing associated metadata. Avoid using this low-level method directly - use BuilderExt convenience methods instead.
Source§

fn get( &self, cat: &Catalog, ) -> Result<Arc<dyn Any + Send + Sync>, InjectionError>

Get an instance of the supplied type
Source§

fn check(&self, cat: &Catalog) -> Result<(), ValidationError>

Validate the dependency tree

Auto Trait Implementations§

§

impl<'a, Iface> Freeze for TypecastBuilder<'a, Iface>
where Iface: ?Sized,

§

impl<'a, Iface> !RefUnwindSafe for TypecastBuilder<'a, Iface>

§

impl<'a, Iface> Send for TypecastBuilder<'a, Iface>
where Iface: ?Sized,

§

impl<'a, Iface> Sync for TypecastBuilder<'a, Iface>
where Iface: ?Sized,

§

impl<'a, Iface> Unpin for TypecastBuilder<'a, Iface>
where Iface: ?Sized,

§

impl<'a, Iface> !UnwindSafe for TypecastBuilder<'a, Iface>

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> BuilderExt for T
where T: Builder + ?Sized,

Source§

fn interfaces_get_all(&self) -> Vec<InterfaceDesc>

Source§

fn interfaces_contain<Iface>(&self) -> bool
where Iface: 'static,

Source§

fn interfaces_contain_type_id(&self, type_id: &TypeId) -> bool

Source§

fn metadata_get_first<Meta>(&self) -> Option<&Meta>
where Meta: 'static,

Source§

fn metadata_find_first<Meta>( &self, pred: impl Fn(&Meta) -> bool, ) -> Option<&Meta>
where Meta: 'static,

Source§

fn metadata_get_all<Meta>(&self) -> Vec<&Meta>
where Meta: 'static,

Source§

fn metadata_find_all<Meta>(&self, pred: impl Fn(&Meta) -> bool) -> Vec<&Meta>
where Meta: 'static,

Source§

fn metadata_contains<Meta>(&self, pred: impl Fn(&Meta) -> bool) -> bool
where Meta: 'static,

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.