Struct game_features::InventoryBuilder[][src]

pub struct InventoryBuilder<K, S: SlotType, U: Default> { /* fields omitted */ }
Expand description

Builder for Inventory.

Implementations

impl<K: Clone, S: SlotType + Clone, U: Default + Clone> InventoryBuilder<K, S, U>[src]

pub fn content(&mut self, value: Vec<Option<ItemInstance<K, U>>>) -> &mut Self[src]

The contents of the Inventory. None values indicate empty but existing inventory slots.

pub fn slot_restriction(&mut self, value: Vec<Option<S>>) -> &mut Self[src]

Restricts what kind of item can go in different slots. This is not compatible with InventorySizingMode::Dynamic.

Maps to the inventory content using the index. None values indicate that there are no restrictions for that slot.

pub fn move_to_front(&mut self, value: MoveToFrontMode) -> &mut Self[src]

Configures how item deletion is handled.

pub fn sizing_mode(&mut self, value: InventorySizingMode) -> &mut Self[src]

Configures if the inventory resizes when item are inserted/removed or not.

pub fn build(&self) -> Result<Inventory<K, S, U>, String>[src]

Builds a new Inventory.

Errors

If a required field has not been initialized.

Trait Implementations

impl<K: Clone, S: Clone + SlotType, U: Clone + Default> Clone for InventoryBuilder<K, S, U>[src]

fn clone(&self) -> InventoryBuilder<K, S, U>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<K: Default, S: Default + SlotType, U: Default> Default for InventoryBuilder<K, S, U>[src]

fn default() -> InventoryBuilder<K, S, U>[src]

Returns the “default value” for a type. Read more

Auto Trait Implementations

impl<K, S, U> RefUnwindSafe for InventoryBuilder<K, S, U> where
    K: RefUnwindSafe,
    S: RefUnwindSafe,
    U: RefUnwindSafe

impl<K, S, U> Send for InventoryBuilder<K, S, U> where
    K: Send,
    S: Send,
    U: Send

impl<K, S, U> Sync for InventoryBuilder<K, S, U> where
    K: Sync,
    S: Sync,
    U: Sync

impl<K, S, U> Unpin for InventoryBuilder<K, S, U> where
    K: Unpin,
    S: Unpin,
    U: Unpin

impl<K, S, U> UnwindSafe for InventoryBuilder<K, S, U> where
    K: UnwindSafe,
    S: UnwindSafe,
    U: UnwindSafe

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.