pub struct Registry<T>(/* private fields */);Expand description
A registry of items that are keyed by a string identifier.
Implementations§
Source§impl<T: Clone + Display + Eq> Registry<T>
impl<T: Clone + Display + Eq> Registry<T>
pub fn empty() -> Self
Sourcepub fn find_many<'a>(
&self,
ids: impl IntoIterator<Item = &'a str>,
) -> impl Iterator<Item = Option<impl Deref<Target = T>>>
pub fn find_many<'a>( &self, ids: impl IntoIterator<Item = &'a str>, ) -> impl Iterator<Item = Option<impl Deref<Target = T>>>
Return the items with the given IDs.
Sourcepub fn register(&self, item: T)
pub fn register(&self, item: T)
Register a new item, replacing any existing item with the same ID.
Sourcepub fn register_many<I: IntoIterator<Item = T>>(&self, items: I)
pub fn register_many<I: IntoIterator<Item = T>>(&self, items: I)
Register a new item, replacing any existing item with the same ID.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Registry<T>
impl<T> !RefUnwindSafe for Registry<T>
impl<T> Send for Registry<T>
impl<T> Sync for Registry<T>
impl<T> Unpin for Registry<T>
impl<T> !UnwindSafe for Registry<T>
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