Struct firecore_pokedex::Dex
source · [−]pub struct Dex<I: Identifiable>(pub HashMap<I::Id, Arc<I>>);
Expand description
A Dex is used to hold types with an identifiable value (see Identifiable).
Tuple Fields
0: HashMap<I::Id, Arc<I>>
Implementations
sourceimpl<I: Identifiable> Dex<I> where
I::Id: Eq + Hash,
impl<I: Identifiable> Dex<I> where
I::Id: Eq + Hash,
sourcepub fn try_get(&self, id: &I::Id) -> Option<&Arc<I>>
pub fn try_get(&self, id: &I::Id) -> Option<&Arc<I>>
Try to get an identifiable value from the Dex.
sourcepub fn get(&self, id: &I::Id) -> &Arc<I>
pub fn get(&self, id: &I::Id) -> &Arc<I>
Get the identifiable value from the Dex, or return the unknown value.
pub fn new(inner: HashMap<I::Id, Arc<I>>) -> Self
pub fn insert(&mut self, v: I) -> Option<Arc<I>> where
I::Id: Clone,
pub fn try_get_named(&self, name: impl AsRef<str>) -> Option<&Arc<I>>
pub fn remove(&mut self, id: &I::Id) -> Option<Arc<I>>
Trait Implementations
sourceimpl<'de, I: Identifiable + Deserialize<'de>> Deserialize<'de> for Dex<I> where
I::Id: Hash + Eq + Clone,
impl<'de, I: Identifiable + Deserialize<'de>> Deserialize<'de> for Dex<I> where
I::Id: Hash + Eq + Clone,
Deserialize Dex from a Vec
sourcefn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<I> RefUnwindSafe for Dex<I> where
I: RefUnwindSafe,
<I as Identifiable>::Id: RefUnwindSafe,
impl<I> Send for Dex<I> where
I: Send + Sync,
<I as Identifiable>::Id: Send,
impl<I> Sync for Dex<I> where
I: Send + Sync,
<I as Identifiable>::Id: Sync,
impl<I> Unpin for Dex<I> where
<I as Identifiable>::Id: Unpin,
impl<I> UnwindSafe for Dex<I> where
I: RefUnwindSafe,
<I as Identifiable>::Id: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more