pub struct Inventory {
pub backpack: Vec<Option<Item>>,
}
Expand description
The basic inventory, that every player has
Fields§
§backpack: Vec<Option<Item>>
Implementations§
Source§impl Inventory
impl Inventory
pub fn as_split(&self) -> (&[Option<Item>], &[Option<Item>])
pub fn as_split_mut(&mut self) -> (&mut [Option<Item>], &mut [Option<Item>])
Sourcepub fn free_slot(&self) -> Option<BagPosition>
pub fn free_slot(&self) -> Option<BagPosition>
Returns a place in the inventory, that can store a new item. This is only useful, when you are dealing with commands, that require a free slot position. The index will be 0 based per inventory
pub fn count_free_slots(&self) -> usize
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Inventory
impl<'de> Deserialize<'de> for Inventory
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Inventory
impl StructuralPartialEq for Inventory
Auto Trait Implementations§
impl Freeze for Inventory
impl RefUnwindSafe for Inventory
impl Send for Inventory
impl Sync for Inventory
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.