pub struct Badge<'a> {
pub position: u16,
pub xp: u8,
pub hidden: u16,
pub name: &'a str,
pub descr: &'a str,
}
Fields§
§position: u16
The order in which badges should be displayed, ascending.
Earned achievments bubble up.
xp: u8
How much XP earning the badge brings to the player.
The number of steps required for the badge to be shown.
If zero, the badge is always shown. If equal to the number of steps required to earn the badge, the badge will be shown only when earned.
name: &'a str
Human-readable badge name.
descr: &'a str
Human-readable badge description. Typically, a hint on how to earn it.
Implementations§
Source§impl Badge<'_>
impl Badge<'_>
Sourcepub const fn validate(&self) -> Result<(), BadgeValidationError>
pub const fn validate(&self) -> Result<(), BadgeValidationError>
Validate badge attributes.
§Errors
Returns BadgeValidationError
if any of the attributes are not valid.
Trait Implementations§
Source§impl<'de: 'a, 'a> Deserialize<'de> for Badge<'a>
impl<'de: 'a, 'a> Deserialize<'de> for Badge<'a>
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
impl<'a> Eq for Badge<'a>
impl<'a> StructuralPartialEq for Badge<'a>
Auto Trait Implementations§
impl<'a> Freeze for Badge<'a>
impl<'a> RefUnwindSafe for Badge<'a>
impl<'a> Send for Badge<'a>
impl<'a> Sync for Badge<'a>
impl<'a> Unpin for Badge<'a>
impl<'a> UnwindSafe for Badge<'a>
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