pub struct StatPropertyData {
pub id: String,
pub name: String,
pub annotation: String,
pub variant: StatPropertyTypeData,
}
Expand description
Structure for sending data about static properties to the frontend.
Some fields simplified compared to original typesafe versions (e.g., pure Strings
are used
instead of more complex typesafe pub structs) to allow for easier (de)serialization.
Fields§
§id: String
§name: String
§annotation: String
§variant: StatPropertyTypeData
Implementations§
source§impl StatPropertyData
impl StatPropertyData
sourcepub fn new_generic(
id: &str,
name: &str,
formula: &str,
annot: &str,
) -> StatPropertyData
pub fn new_generic( id: &str, name: &str, formula: &str, annot: &str, ) -> StatPropertyData
Shorthand to create new generic StatPropertyData
instance given a properties
id
, name
, formula
, and annotation
.
sourcepub fn from_property(
id: &StatPropertyId,
property: &StatProperty,
) -> StatPropertyData
pub fn from_property( id: &StatPropertyId, property: &StatProperty, ) -> StatPropertyData
Create new StatPropertyData
object given a reference to a property and its id
.
sourcepub fn to_property(&self) -> Result<StatProperty, String>
pub fn to_property(&self) -> Result<StatProperty, String>
Extract the corresponding StatProperty
instance from this StatPropertyData
.
sourcefn new_raw(
id: &str,
name: &str,
variant: StatPropertyTypeData,
annot: &str,
) -> StatPropertyData
fn new_raw( id: &str, name: &str, variant: StatPropertyTypeData, annot: &str, ) -> StatPropertyData
(internal) Shorthand to create new StatPropertyData
instance given all its fields.
Trait Implementations§
source§impl Clone for StatPropertyData
impl Clone for StatPropertyData
source§fn clone(&self) -> StatPropertyData
fn clone(&self) -> StatPropertyData
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 Debug for StatPropertyData
impl Debug for StatPropertyData
source§impl<'de> Deserialize<'de> for StatPropertyData
impl<'de> Deserialize<'de> for StatPropertyData
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
source§impl<'de> JsonSerde<'de> for StatPropertyData
impl<'de> JsonSerde<'de> for StatPropertyData
source§fn to_json_str(&self) -> String
fn to_json_str(&self) -> String
Wrapper for json serialization.
source§fn to_pretty_json_str(&self) -> String
fn to_pretty_json_str(&self) -> String
Wrapper for pretty json serialization with indentation.
source§impl PartialEq for StatPropertyData
impl PartialEq for StatPropertyData
source§impl Serialize for StatPropertyData
impl Serialize for StatPropertyData
impl StructuralPartialEq for StatPropertyData
Auto Trait Implementations§
impl Freeze for StatPropertyData
impl RefUnwindSafe for StatPropertyData
impl Send for StatPropertyData
impl Sync for StatPropertyData
impl Unpin for StatPropertyData
impl UnwindSafe for StatPropertyData
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)