pub struct ItemInstanceBuilder<K, U: Default> { /* private fields */ }Expand description
Builder for ItemInstance.
Implementations§
Source§impl<K: Clone, U: Default + Clone> ItemInstanceBuilder<K, U>
impl<K: Clone, U: Default + Clone> ItemInstanceBuilder<K, U>
Sourcepub fn key(&mut self, value: K) -> &mut Self
pub fn key(&mut self, value: K) -> &mut Self
The key specifies which ItemDefinition defines the properties of this item stack.
Sourcepub fn quantity(&mut self, value: usize) -> &mut Self
pub fn quantity(&mut self, value: usize) -> &mut Self
The number of items in the stack.
Should not be over the associated ItemDefinition::maximum_stack.
Sourcepub fn durability(&mut self, value: Option<usize>) -> &mut Self
pub fn durability(&mut self, value: Option<usize>) -> &mut Self
The remaining durability of this item, if any. If set to None, it means that the item is unbreakable.
Sourcepub fn build(&self) -> Result<ItemInstance<K, U>, ItemInstanceBuilderError>
pub fn build(&self) -> Result<ItemInstance<K, U>, ItemInstanceBuilderError>
Trait Implementations§
Auto Trait Implementations§
impl<K, U> Freeze for ItemInstanceBuilder<K, U>
impl<K, U> RefUnwindSafe for ItemInstanceBuilder<K, U>where
K: RefUnwindSafe,
U: RefUnwindSafe,
impl<K, U> Send for ItemInstanceBuilder<K, U>
impl<K, U> Sync for ItemInstanceBuilder<K, U>
impl<K, U> Unpin for ItemInstanceBuilder<K, U>
impl<K, U> UnwindSafe for ItemInstanceBuilder<K, U>where
K: UnwindSafe,
U: UnwindSafe,
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