Skip to main content

ComponentMap

Struct ComponentMap 

Source
pub struct ComponentMap<Key, Args, Comp, FnInit> { /* private fields */ }

Implementations§

Source§

impl<Key, Args, Comp, FnInit> ComponentMap<Key, Args, Comp, FnInit>

Source

pub async fn try_init_async<Error>( args: impl IntoIterator<Item = (Key, Args)>, init: FnInit, ) -> Result<Self, Error>
where Key: Eq + Hash, FnInit: AsyncFn(&Args) -> Result<Comp, Error> + Clone,

Source

pub async fn try_reinit_all_async<Error>( &mut self, ) -> impl Iterator<Item = Keyed<&Key, Result<Comp, Error>>>
where Key: Clone, FnInit: AsyncFn(&Args) -> Result<Comp, Error> + Clone,

Source

pub async fn try_reinit_async<Error>( &mut self, keys: impl IntoIterator<Item = Key>, ) -> impl Iterator<Item = Keyed<Key, Option<Result<Comp, Error>>>>
where Key: Eq + Hash + Clone, FnInit: AsyncFn(&Args) -> Result<Comp, Error> + Clone,

Source

pub async fn try_update_async<Error>( &mut self, updates: impl IntoIterator<Item = (Key, Args)>, ) -> impl Iterator<Item = Keyed<Key, Option<Result<WithArgs<Args, Comp>, Error>>>>
where Key: Clone + Eq + Hash, FnInit: AsyncFn(&Args) -> Result<Comp, Error> + Clone,

Source§

impl<Key, Args, Comp, FnInit> ComponentMap<Key, Args, Comp, FnInit>

Source

pub async fn init_async( args: impl IntoIterator<Item = (Key, Args)>, init: FnInit, ) -> Self
where Key: Eq + Hash, FnInit: AsyncFn(&Args) -> Comp + Clone,

Source

pub async fn reinit_all_async( &mut self, ) -> impl Iterator<Item = Keyed<&Key, Comp>>
where Key: Clone, FnInit: AsyncFn(&Args) -> Comp + Clone,

Source

pub async fn reinit_async( &mut self, keys: impl IntoIterator<Item = Key>, ) -> impl Iterator<Item = Keyed<Key, Option<Comp>>>
where Key: Eq + Hash + Clone, FnInit: AsyncFn(&Args) -> Comp + Clone,

Source

pub async fn update_async( &mut self, updates: impl IntoIterator<Item = (Key, Args)>, ) -> impl Iterator<Item = Keyed<Key, Option<WithArgs<Args, Comp>>>>
where Key: Clone + Eq + Hash, FnInit: AsyncFn(&Args) -> Comp + Clone,

Source§

impl<Key, Args, Comp, FnInit> ComponentMap<Key, Args, Comp, FnInit>

Source

pub fn try_init<Error>( args: impl IntoIterator<Item = (Key, Args)>, init: FnInit, ) -> Result<Self, Error>
where Key: Eq + Hash, FnInit: Fn(&Args) -> Result<Comp, Error>,

Source

pub fn try_reinit_all<Error>( &mut self, ) -> impl Iterator<Item = Keyed<&Key, Result<Comp, Error>>>
where FnInit: Fn(&Args) -> Result<Comp, Error>,

Source

pub fn try_reinit<Error>( &mut self, keys: impl IntoIterator<Item = Key>, ) -> impl Iterator<Item = Keyed<Key, Option<Result<Comp, Error>>>>
where Key: Eq + Hash, FnInit: Fn(&Args) -> Result<Comp, Error>,

Source

pub fn try_update<Error>( &mut self, updates: impl IntoIterator<Item = (Key, Args)>, ) -> impl Iterator<Item = Keyed<Key, Option<Result<WithArgs<Args, Comp>, Error>>>>
where Key: Clone + Eq + Hash, FnInit: Fn(&Args) -> Result<Comp, Error>,

Source§

impl<Key, Args, Comp, FnInit> ComponentMap<Key, Args, Comp, FnInit>

Source

pub fn init(args: impl IntoIterator<Item = (Key, Args)>, init: FnInit) -> Self
where Key: Eq + Hash, FnInit: Fn(&Args) -> Comp,

Source

pub fn reinit_all(&mut self) -> impl Iterator<Item = Keyed<&Key, Comp>>
where FnInit: Fn(&Args) -> Comp,

Source

pub fn reinit( &mut self, keys: impl IntoIterator<Item = Key>, ) -> impl Iterator<Item = Keyed<Key, Option<Comp>>>
where Key: Eq + Hash, FnInit: Fn(&Args) -> Comp,

Source

pub fn update( &mut self, updates: impl IntoIterator<Item = (Key, Args)>, ) -> impl Iterator<Item = Keyed<Key, Option<WithArgs<Args, Comp>>>>
where Key: Clone + Eq + Hash, FnInit: Fn(&Args) -> Comp,

Source§

impl<Key, Args, Comp, FnInit> ComponentMap<Key, Args, Comp, FnInit>

Source

pub const fn new( map: HashMap<Key, WithArgs<Args, Comp>>, init: FnInit, ) -> ComponentMap<Key, Args, Comp, FnInit>

Source§

impl<Key, Args, Comp, FnInit> ComponentMap<Key, Args, Comp, FnInit>

Source

pub fn components(&self) -> &HashMap<Key, WithArgs<Args, Comp>>

Source

pub fn components_mut(&mut self) -> &mut HashMap<Key, WithArgs<Args, Comp>>

Source

pub fn fn_init(&self) -> &FnInit

Trait Implementations§

Source§

impl<Key: Debug, Args: Debug, Comp: Debug, FnInit: Debug> Debug for ComponentMap<Key, Args, Comp, FnInit>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Key, Args, Comp, FnInit> Freeze for ComponentMap<Key, Args, Comp, FnInit>
where FnInit: Freeze,

§

impl<Key, Args, Comp, FnInit> RefUnwindSafe for ComponentMap<Key, Args, Comp, FnInit>
where FnInit: RefUnwindSafe, Key: RefUnwindSafe, Comp: RefUnwindSafe, Args: RefUnwindSafe,

§

impl<Key, Args, Comp, FnInit> Send for ComponentMap<Key, Args, Comp, FnInit>
where FnInit: Send, Key: Send, Comp: Send, Args: Send,

§

impl<Key, Args, Comp, FnInit> Sync for ComponentMap<Key, Args, Comp, FnInit>
where FnInit: Sync, Key: Sync, Comp: Sync, Args: Sync,

§

impl<Key, Args, Comp, FnInit> Unpin for ComponentMap<Key, Args, Comp, FnInit>
where FnInit: Unpin, Key: Unpin, Comp: Unpin, Args: Unpin,

§

impl<Key, Args, Comp, FnInit> UnwindSafe for ComponentMap<Key, Args, Comp, FnInit>
where FnInit: UnwindSafe, Key: UnwindSafe, Comp: UnwindSafe, Args: UnwindSafe,

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.