Struct game_features::ItemDefinition [−][src]
pub struct ItemDefinition<K, S, D: Default> { pub key: K, pub slot_type: S, pub name: String, pub friendly_name: String, pub description: String, pub maximum_stack: Option<usize>, pub maximum_durability: Option<usize>, pub user_data: D, }
Expand description
An ItemDefinition
stores the different properties of a type of item.
It is a schema that contains the data which isn’t changing between different item instances.
Generic Types:
- K: Type of the key. Usually an enum or a number (ie u32).
- T: Type of the different item types. For example, an armor-type item can not be placed into a
weapon-type inventory slot. If you don’t need to make the distinction between different item
types, use the
()
type. - D: The type of the custom user data. If you don’t have any, use the
()
type. It can (and probably should) be different than the custom user data used onItemInstance
s
Fields
key: K
The key identifying this item definition.
slot_type: S
The type / item group that this item definition is part of.
name: String
The display name of this item definition.
friendly_name: String
The friendly name of this item definition. Mostly used to find items by name instead of by key.
description: String
The display description of this item definition.
maximum_stack: Option<usize>
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.
maximum_durability: Option<usize>
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.
user_data: D
Custom user data. For example: rarity, weight, list of allowed upgrades, etc…
Implementations
impl<K, S, D: Default> ItemDefinition<K, S, D>
[src]
impl<K, S, D: Default> ItemDefinition<K, S, D>
[src]Trait Implementations
impl<K: Clone, S: Clone, D: Clone + Default> Clone for ItemDefinition<K, S, D>
[src]
impl<K: Clone, S: Clone, D: Clone + Default> Clone for ItemDefinition<K, S, D>
[src]fn clone(&self) -> ItemDefinition<K, S, D>
[src]
fn clone(&self) -> ItemDefinition<K, S, D>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<'de, K, S, D: Default> Deserialize<'de> for ItemDefinition<K, S, D> where
K: Deserialize<'de>,
S: Deserialize<'de>,
D: Deserialize<'de>,
[src]
impl<'de, K, S, D: Default> Deserialize<'de> for ItemDefinition<K, S, D> where
K: Deserialize<'de>,
S: Deserialize<'de>,
D: Deserialize<'de>,
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<K, S, D> RefUnwindSafe for ItemDefinition<K, S, D> where
D: RefUnwindSafe,
K: RefUnwindSafe,
S: RefUnwindSafe,
D: RefUnwindSafe,
K: RefUnwindSafe,
S: RefUnwindSafe,
impl<K, S, D> Send for ItemDefinition<K, S, D> where
D: Send,
K: Send,
S: Send,
D: Send,
K: Send,
S: Send,
impl<K, S, D> Sync for ItemDefinition<K, S, D> where
D: Sync,
K: Sync,
S: Sync,
D: Sync,
K: Sync,
S: Sync,
impl<K, S, D> Unpin for ItemDefinition<K, S, D> where
D: Unpin,
K: Unpin,
S: Unpin,
D: Unpin,
K: Unpin,
S: Unpin,
impl<K, S, D> UnwindSafe for ItemDefinition<K, S, D> where
D: UnwindSafe,
K: UnwindSafe,
S: UnwindSafe,
D: UnwindSafe,
K: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
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]
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,