pub struct NonConsumable { /* private fields */ }
Expand description
Represents a non-consumable material resource that can be used in a project.
Implementations§
Source§impl NonConsumable
impl NonConsumable
Sourcepub fn hourly_rate(&self) -> Option<u16>
pub fn hourly_rate(&self) -> Option<u16>
Returns the hourly rate of the non-consumable material.
§Example
use planter_core::resources::NonConsumable;
let non_consumable = NonConsumable::new("Steel".to_owned());
assert_eq!(non_consumable.hourly_rate(), None);
Sourcepub fn update_hourly_rate(&mut self, hourly_rate: u16)
pub fn update_hourly_rate(&mut self, hourly_rate: u16)
Updates the hourly_rate of the non consumable material.
§Example
use planter_core::resources::NonConsumable;
let mut non_consumable = NonConsumable::new("Steel".to_owned());
non_consumable.update_hourly_rate(3);
assert_eq!(non_consumable.hourly_rate(), Some(3));
Sourcepub fn remove_hourly_rate(&mut self)
pub fn remove_hourly_rate(&mut self)
Remove the cost per unit of the non consumable material.
§Example
use planter_core::resources::NonConsumable;
let mut non_consumable = NonConsumable::new("Steel".to_owned());
non_consumable.update_hourly_rate(3);
assert_eq!(non_consumable.hourly_rate(), Some(3));
non_consumable.remove_hourly_rate();
assert_eq!(non_consumable.hourly_rate(), None);
Trait Implementations§
Source§impl Clone for NonConsumable
impl Clone for NonConsumable
Source§fn clone(&self) -> NonConsumable
fn clone(&self) -> NonConsumable
Returns a duplicate 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 Debug for NonConsumable
impl Debug for NonConsumable
Source§impl Default for NonConsumable
impl Default for NonConsumable
Source§fn default() -> NonConsumable
fn default() -> NonConsumable
Returns the “default value” for a type. Read more
Source§impl From<Consumable> for NonConsumable
impl From<Consumable> for NonConsumable
Source§fn from(value: Consumable) -> Self
fn from(value: Consumable) -> Self
Converts to this type from the input type.
Source§impl From<NonConsumable> for Consumable
impl From<NonConsumable> for Consumable
Source§fn from(value: NonConsumable) -> Self
fn from(value: NonConsumable) -> Self
Converts to this type from the input type.
Source§impl PartialEq for NonConsumable
impl PartialEq for NonConsumable
impl Eq for NonConsumable
impl StructuralPartialEq for NonConsumable
Auto Trait Implementations§
impl Freeze for NonConsumable
impl RefUnwindSafe for NonConsumable
impl Send for NonConsumable
impl Sync for NonConsumable
impl Unpin for NonConsumable
impl UnwindSafe for NonConsumable
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more