[][src]Struct game_features::ItemDefinitionBuilder

pub struct ItemDefinitionBuilder<K, T, D: Default> { /* fields omitted */ }

Builder for ItemDefinition.

Methods

impl<K: Clone, T: Clone, D: Default + Clone> ItemDefinitionBuilder<K, T, D>[src]

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

The key identifying this item definition.

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

The type / item group that this item definition is part of.

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

The display name of this item definition.

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

The friendly name of this item definition. Mostly used to find items by name instead of by key.

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

The display description of this item definition.

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

The maximum number of elements that can be in an item stack. Setting this value to 1 disables the ability to stack this type of item.

pub fn maximum_durability(&mut self, value: Option<usize>) -> &mut Self[src]

The default maximum durability of this item. Setting this to None means that this item type doesn't use the concept of durability and is unbreakable.

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

Custom user data. For example: rarity, weight, list of allowed upgrades, etc...

pub fn build(&self) -> Result<ItemDefinition<K, T, D>, String>[src]

Builds a new ItemDefinition.

Errors

If a required field has not been initialized.

Trait Implementations

impl<K: Default, T: Default, D: Default + Default> Default for ItemDefinitionBuilder<K, T, D>[src]

impl<K: Clone, T: Clone, D: Clone + Default> Clone for ItemDefinitionBuilder<K, T, D>[src]

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

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<K, T, D> Send for ItemDefinitionBuilder<K, T, D> where
    D: Send,
    K: Send,
    T: Send

impl<K, T, D> Sync for ItemDefinitionBuilder<K, T, D> where
    D: Sync,
    K: Sync,
    T: Sync

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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<T> Any for T where
    T: 'static + ?Sized
[src]