pub struct Inventory { /* private fields */ }Implementations§
Source§impl Inventory
impl Inventory
pub fn new(capacity: usize, max_weight: f32) -> Self
pub fn add_item(&mut self, item: Item) -> bool
pub fn remove_item(&mut self, slot_idx: usize) -> Option<Item>
pub fn remove_count(&mut self, slot_idx: usize, count: u32) -> u32
pub fn get(&self, slot_idx: usize) -> Option<&ItemStack>
pub fn get_mut(&mut self, slot_idx: usize) -> Option<&mut ItemStack>
pub fn find_item_by_id(&self, id: u64) -> Option<usize>
pub fn find_items_by_category(&self, cat: ItemCategory) -> Vec<usize>
pub fn used_slots(&self) -> usize
pub fn free_slots(&self) -> usize
pub fn is_full(&self) -> bool
pub fn total_value(&self) -> u64
pub fn add_gold(&mut self, amount: u64)
pub fn remove_gold(&mut self, amount: u64) -> bool
pub fn gold(&self) -> u64
pub fn weight(&self) -> f32
pub fn max_weight(&self) -> f32
pub fn capacity(&self) -> usize
Sourcepub fn transfer(&mut self, slot_idx: usize, target: &mut Inventory) -> bool
pub fn transfer(&mut self, slot_idx: usize, target: &mut Inventory) -> bool
Transfer item from this inventory to another.
pub fn iter(&self) -> impl Iterator<Item = (usize, &ItemStack)>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Inventory
impl RefUnwindSafe for Inventory
impl Send for Inventory
impl Sync for Inventory
impl Unpin for Inventory
impl UnsafeUnpin for Inventory
impl UnwindSafe for Inventory
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