pub struct Recipe {
pub id: u64,
pub name: String,
pub ingredients: Vec<RecipeIngredient>,
pub result_item_id: u64,
pub result_count: u32,
pub required_level: u32,
pub success_chance: f32,
pub station: CraftingStation,
pub xp_reward: u64,
}Fields§
§id: u64§name: String§ingredients: Vec<RecipeIngredient>§result_item_id: u64§result_count: u32§required_level: u32§success_chance: f32§station: CraftingStation§xp_reward: u64Implementations§
Source§impl Recipe
impl Recipe
pub fn new(id: u64, name: impl Into<String>, station: CraftingStation) -> Self
pub fn add_ingredient(self, item_id: u64, count: u32) -> Self
pub fn with_result(self, item_id: u64, count: u32) -> Self
pub fn with_success_chance(self, chance: f32) -> Self
pub fn with_level(self, level: u32) -> Self
pub fn can_craft(&self, inventory: &Inventory, player_level: u32) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Recipe
impl RefUnwindSafe for Recipe
impl Send for Recipe
impl Sync for Recipe
impl Unpin for Recipe
impl UnsafeUnpin for Recipe
impl UnwindSafe for Recipe
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.