pub struct BoxStore<P: MonsterProvider> { /* private fields */ }Expand description
A collection of storage boxes plus a “currently selected” box, with both the box count and per-box capacity supplied by the game.
Implementations§
Source§impl<P: MonsterProvider> BoxStore<P>
impl<P: MonsterProvider> BoxStore<P>
Sourcepub fn new(box_count: usize, box_capacity: usize) -> Self
pub fn new(box_count: usize, box_capacity: usize) -> Self
Create box_count boxes, each with box_capacity (both supplied).
Sourcepub fn current_index(&self) -> usize
pub fn current_index(&self) -> usize
Index of the currently selected box.
Sourcepub fn current(&self) -> &StorageBox<P>
pub fn current(&self) -> &StorageBox<P>
Borrow the currently selected box.
Sourcepub fn current_mut(&mut self) -> &mut StorageBox<P>
pub fn current_mut(&mut self) -> &mut StorageBox<P>
Mutably borrow the currently selected box.
Sourcepub fn get(&self, index: usize) -> Option<&StorageBox<P>>
pub fn get(&self, index: usize) -> Option<&StorageBox<P>>
Borrow a specific box by index.
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut StorageBox<P>>
pub fn get_mut(&mut self, index: usize) -> Option<&mut StorageBox<P>>
Mutably borrow a specific box by index.
Trait Implementations§
impl<P: Eq + MonsterProvider> Eq for BoxStore<P>
impl<P: PartialEq + MonsterProvider> StructuralPartialEq for BoxStore<P>
Auto Trait Implementations§
impl<P> Freeze for BoxStore<P>
impl<P> RefUnwindSafe for BoxStore<P>where
<P as MonsterProvider>::SpeciesId: RefUnwindSafe,
<P as MonsterProvider>::Genetics: RefUnwindSafe,
<P as MonsterProvider>::Training: RefUnwindSafe,
<P as MonsterProvider>::MoveId: RefUnwindSafe,
<P as MonsterProvider>::Stat: RefUnwindSafe,
impl<P> Send for BoxStore<P>where
<P as MonsterProvider>::SpeciesId: Send,
<P as MonsterProvider>::Genetics: Send,
<P as MonsterProvider>::Training: Send,
<P as MonsterProvider>::MoveId: Send,
<P as MonsterProvider>::Stat: Send,
impl<P> Sync for BoxStore<P>where
<P as MonsterProvider>::SpeciesId: Sync,
<P as MonsterProvider>::Genetics: Sync,
<P as MonsterProvider>::Training: Sync,
<P as MonsterProvider>::MoveId: Sync,
<P as MonsterProvider>::Stat: Sync,
impl<P> Unpin for BoxStore<P>where
<P as MonsterProvider>::SpeciesId: Unpin,
<P as MonsterProvider>::Genetics: Unpin,
<P as MonsterProvider>::Training: Unpin,
<P as MonsterProvider>::MoveId: Unpin,
<P as MonsterProvider>::Stat: Unpin,
impl<P> UnsafeUnpin for BoxStore<P>
impl<P> UnwindSafe for BoxStore<P>where
<P as MonsterProvider>::SpeciesId: UnwindSafe,
<P as MonsterProvider>::Genetics: UnwindSafe,
<P as MonsterProvider>::Training: UnwindSafe,
<P as MonsterProvider>::MoveId: UnwindSafe,
<P as MonsterProvider>::Stat: UnwindSafe,
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