pub struct ItemDefinitionBuilder<K, S, D: Default> { /* private fields */ }Expand description
Builder for ItemDefinition.
Implementations§
Source§impl<K: Clone, S: Clone, D: Default + Clone> ItemDefinitionBuilder<K, S, D>
impl<K: Clone, S: Clone, D: Default + Clone> ItemDefinitionBuilder<K, S, D>
Sourcepub fn slot_type(&mut self, value: S) -> &mut Self
pub fn slot_type(&mut self, value: S) -> &mut Self
The type / item group that this item definition is part of.
Sourcepub fn friendly_name(&mut self, value: String) -> &mut Self
pub fn friendly_name(&mut self, value: String) -> &mut Self
The friendly name of this item definition. Mostly used to find items by name instead of by key.
Sourcepub fn description(&mut self, value: String) -> &mut Self
pub fn description(&mut self, value: String) -> &mut Self
The display description of this item definition.
Sourcepub fn maximum_stack(&mut self, value: Option<usize>) -> &mut Self
pub fn maximum_stack(&mut self, value: Option<usize>) -> &mut Self
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.
Sourcepub fn maximum_durability(&mut self, value: Option<usize>) -> &mut Self
pub fn maximum_durability(&mut self, value: Option<usize>) -> &mut Self
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.
Sourcepub fn user_data(&mut self, value: D) -> &mut Self
pub fn user_data(&mut self, value: D) -> &mut Self
Custom user data. For example: rarity, weight, list of allowed upgrades, etc…
Sourcepub fn build(
&self,
) -> Result<ItemDefinition<K, S, D>, ItemDefinitionBuilderError>
pub fn build( &self, ) -> Result<ItemDefinition<K, S, D>, ItemDefinitionBuilderError>
Trait Implementations§
Auto Trait Implementations§
impl<K, S, D> Freeze for ItemDefinitionBuilder<K, S, D>
impl<K, S, D> RefUnwindSafe for ItemDefinitionBuilder<K, S, D>
impl<K, S, D> Send for ItemDefinitionBuilder<K, S, D>
impl<K, S, D> Sync for ItemDefinitionBuilder<K, S, D>
impl<K, S, D> Unpin for ItemDefinitionBuilder<K, S, D>
impl<K, S, D> UnwindSafe for ItemDefinitionBuilder<K, S, D>
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