pub struct ConsumableItem {
pub info: ItemInfo,
pub effect: String,
pub rarity: ItemRarity,
pub amount_in_inventory: u32,
}
Fields§
§info: ItemInfo
§effect: String
§rarity: ItemRarity
§amount_in_inventory: u32
Implementations§
Source§impl ConsumableItem
impl ConsumableItem
pub fn new_health_potion(rarity: ItemRarity) -> Self
pub fn new_mana_potion(rarity: ItemRarity) -> Self
Sourcepub fn use_item(
&self,
character: &mut PlayerCharacter,
) -> (String, ItemRarity, String)
pub fn use_item( &self, character: &mut PlayerCharacter, ) -> (String, ItemRarity, String)
Returns text telling what the item did.
Trait Implementations§
Source§impl Clone for ConsumableItem
impl Clone for ConsumableItem
Source§fn clone(&self) -> ConsumableItem
fn clone(&self) -> ConsumableItem
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'de> Deserialize<'de> for ConsumableItem
impl<'de> Deserialize<'de> for ConsumableItem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ConsumableItem
impl RefUnwindSafe for ConsumableItem
impl Send for ConsumableItem
impl Sync for ConsumableItem
impl Unpin for ConsumableItem
impl UnwindSafe for ConsumableItem
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