[][src]Struct sulis_state::inventory::Inventory

pub struct Inventory {
    pub equipped: HashMap<Slot, ItemState>,
    pub quick: HashMap<QuickSlot, ItemState>,
}

Fields

equipped: HashMap<Slot, ItemState>quick: HashMap<QuickSlot, ItemState>

Implementations

impl Inventory[src]

pub fn empty() -> Inventory[src]

pub fn load(
    &mut self,
    equipped: Vec<Option<ItemSaveState>>,
    quick: Vec<Option<ItemSaveState>>
) -> Result<(), Error>
[src]

pub fn alt_weapon_style(&self) -> WeaponStyle[src]

pub fn weapon_style(&self) -> WeaponStyle[src]

pub fn quick(&self, slot: QuickSlot) -> Option<&ItemState>[src]

pub fn equipped(&self, slot: Slot) -> Option<&ItemState>[src]

pub fn equipped_iter(&self) -> EquippedIterator<'_>

Notable traits for EquippedIterator<'a>

impl<'a> Iterator for EquippedIterator<'a> type Item = &'a ItemState;
[src]

Returns an iterator traversing all equipped items in this inventory. This will only include slots that actually have an item equipped

pub fn swap_weapon_set(&mut self)[src]

#[must_use]pub fn clear_quick(&mut self, quick_slot: QuickSlot) -> Option<ItemState>[src]

pub fn can_set_quick(
    &mut self,
    item_state: &ItemState,
    slot: QuickSlot,
    actor: &Rc<Actor>
) -> bool
[src]

Returns true if the given item can be set to the given quick slot, false otherwise

#[must_use]pub fn set_quick(
    &mut self,
    item_state: ItemState,
    slot: QuickSlot
) -> Option<ItemState>
[src]

Sets the given item to the quick slot. The caller must validate that the item can be set with can_set_quick prior to doing this

#[must_use]pub fn equip(
    &mut self,
    item_state: ItemState,
    preferred_slot: Option<Slot>
) -> Vec<ItemState>
[src]

Equips the specified item. you must verify that the item can be equipped with can_equip first. Returns a vec of any items that were unequipped as a result of equipping this item

#[must_use]pub fn clear_quickslot(&mut self, quick_slot: QuickSlot) -> Option<ItemState>[src]

#[must_use]pub fn unequip(&mut self, slot: Slot) -> Option<ItemState>[src]

pub fn get_image_layers(&self) -> HashMap<ImageLayer, Rc<dyn Image>>[src]

Trait Implementations

impl Clone for Inventory[src]

Auto Trait Implementations

impl !RefUnwindSafe for Inventory

impl !Send for Inventory

impl !Sync for Inventory

impl Unpin for Inventory

impl !UnwindSafe for Inventory

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]