pub struct StatDefinition<K> {
pub key: K,
pub name: String,
pub friendly_name: String,
pub default_value: f64,
pub min_value: Option<f64>,
pub max_value: Option<f64>,
pub icon_path: Option<String>,
}
Expand description
The definition of a stat. A stat is a named float value optionally constrained between two other values and with a default value. It is used to create effects, conditions and in general to hold state for each entity. For example, it can be used to contain the health or mana of an entity just as well as it can be used to keep track of the number of enemies positioned around an entity.
Fields§
§key: K
The key.
name: String
The name.
friendly_name: String
The computer friendly name.
default_value: f64
The default value.
min_value: Option<f64>
The minimum value.
max_value: Option<f64>
The maximum value.
icon_path: Option<String>
The icon of this stat.
Implementations§
Source§impl<K> StatDefinition<K>
impl<K> StatDefinition<K>
Source§impl<K: Clone> StatDefinition<K>
impl<K: Clone> StatDefinition<K>
Sourcepub fn default_instance(&self) -> StatInstance<K>
pub fn default_instance(&self) -> StatInstance<K>
Creates the default StatInstance for this StatDefinition.
Trait Implementations§
Source§impl<K: Clone> Clone for StatDefinition<K>
impl<K: Clone> Clone for StatDefinition<K>
Source§fn clone(&self) -> StatDefinition<K>
fn clone(&self) -> StatDefinition<K>
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<K: Debug> Debug for StatDefinition<K>
impl<K: Debug> Debug for StatDefinition<K>
Source§impl<'de, K> Deserialize<'de> for StatDefinition<K>where
K: Deserialize<'de>,
impl<'de, K> Deserialize<'de> for StatDefinition<K>where
K: Deserialize<'de>,
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<K> Freeze for StatDefinition<K>where
K: Freeze,
impl<K> RefUnwindSafe for StatDefinition<K>where
K: RefUnwindSafe,
impl<K> Send for StatDefinition<K>where
K: Send,
impl<K> Sync for StatDefinition<K>where
K: Sync,
impl<K> Unpin for StatDefinition<K>where
K: Unpin,
impl<K> UnwindSafe for StatDefinition<K>where
K: 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