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>
impl<P> Send for BoxStore<P>
impl<P> Sync for BoxStore<P>
impl<P> Unpin for BoxStore<P>
impl<P> UnsafeUnpin for BoxStore<P>
impl<P> UnwindSafe for BoxStore<P>
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