#[non_exhaustive]pub enum StatsRequest {
SetStat {
name: String,
value: StatValue,
},
AddStat {
name: String,
delta: StatValue,
},
UnlockAchievement {
name: String,
},
ClearAchievement {
name: String,
},
IndicateAchievementProgress {
name: String,
current: u32,
max: u32,
},
StoreStats,
ResetAllStats {
achievements_too: bool,
},
}stats only.Expand description
A stats request. All kinds travel in this ONE message type, so they are applied in the order
they were written. #[non_exhaustive]: match with a _ arm (construct the variants,
or use the helper constructors, as usual).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
SetStat
Set a stat. The value’s variant must match the stat’s type (INT = I32, FLOAT = F32).
AddStat
Add to a stat (read, add, write; the delta’s variant must match the stat’s type). An I32
sum saturates.
UnlockAchievement
Unlock an achievement. Unlocking an unlocked achievement does nothing.
ClearAchievement
Lock an achievement again (meant for development and tests).
IndicateAchievementProgress
Show the “current / max” progress popup of an achievement. It sets and unlocks nothing
(not even at current == max); current is clamped to max, max == 0 is refused.
StoreStats
Store now (as soon as StatsSettings::min_store_gap allows and no store is in flight).
Without Steam it is a silent no-op.
ResetAllStats
Reset every stat, and optionally every achievement, of the local user (Steam stores it). Meant for development and tests.
Implementations§
Source§impl StatsRequest
impl StatsRequest
Sourcepub fn unlock_achievement(name: impl Into<String>) -> Self
pub fn unlock_achievement(name: impl Into<String>) -> Self
Sourcepub fn clear_achievement(name: impl Into<String>) -> Self
pub fn clear_achievement(name: impl Into<String>) -> Self
Trait Implementations§
Source§impl Clone for StatsRequest
impl Clone for StatsRequest
Source§impl Debug for StatsRequest
impl Debug for StatsRequest
impl Message for StatsRequest
Source§impl PartialEq for StatsRequest
impl PartialEq for StatsRequest
impl StructuralPartialEq for StatsRequest
Auto Trait Implementations§
impl Freeze for StatsRequest
impl RefUnwindSafe for StatsRequest
impl Send for StatsRequest
impl Sync for StatsRequest
impl Unpin for StatsRequest
impl UnsafeUnpin for StatsRequest
impl UnwindSafe for StatsRequest
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
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>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Source§impl<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.