Skip to main content

ArcadeStats

Struct ArcadeStats 

Source
pub struct ArcadeStats {
    pub diagnostics_run: u32,
    pub fixes_applied: u32,
    pub perfect_health_streak: u32,
    pub processes_killed: u32,
    pub env_files_created: u32,
    pub total_arcade_plays: u32,
    pub best_arcade_score: u32,
    pub last_diagnostic_time_ms: Option<u32>,
    pub times_run: HashMap<u32, u32>,
}
Expand description

Lifetime usage counters that drive badge unlocks.

use limitless_cli::modules::achievements::ArcadeStats;
let mut stats = ArcadeStats::default();
stats.record_diagnostic_at(4200, 3);
stats.record_fix();
stats.record_arcade_game(800);
assert_eq!(stats.diagnostics_run, 1);
assert_eq!(stats.last_diagnostic_time_ms, Some(4200));
assert_eq!(stats.times_run.get(&3), Some(&1));
assert_eq!(stats.best_arcade_score, 800);

Fields§

§diagnostics_run: u32

Total diagnostic scans run.

§fixes_applied: u32

Total fixes applied.

§perfect_health_streak: u32

Consecutive runs where every check passed.

§processes_killed: u32

Ghost processes killed.

§env_files_created: u32

.env files created.

§total_arcade_plays: u32

Games played in SyntaxBreaker.

§best_arcade_score: u32

Best SyntaxBreaker score.

§last_diagnostic_time_ms: Option<u32>

Duration (ms) of the most recent diagnostic scan, for BadgeCondition::SpeedRunner. None until the first scan.

§times_run: HashMap<u32, u32>

Map of local hour → number of runs started at that hour, for BadgeCondition::NightOwl.

Implementations§

Source§

impl ArcadeStats

Source

pub fn record_diagnostic(&mut self, duration_ms: u32)

Records a diagnostic scan, its duration, and the current UTC hour. Local-hour bookkeeping on non-UTC machines uses the configured offset; record_diagnostic_at is the deterministic variant used by tests.

Source

pub fn record_diagnostic_at(&mut self, duration_ms: u32, hour: u32)

Records a diagnostic scan with an explicit hour-of-day.

Source

pub fn record_perfect_health(&mut self)

Marks the current run as happy, extending the perfect-health streak.

Source

pub fn reset_perfect_health(&mut self)

Ends a streak (a run with a failing check).

Source

pub fn record_fix(&mut self)

Records an applied fix.

Source

pub fn record_process_killed(&mut self)

Records a killed ghost process.

Source

pub fn record_env_created(&mut self)

Records a created .env file.

Source

pub fn record_arcade_game(&mut self, score: u32)

Records a finished SyntaxBreaker game, keeping the best score.

Trait Implementations§

Source§

impl Clone for ArcadeStats

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ArcadeStats

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ArcadeStats

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ArcadeStats

Source§

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 Eq for ArcadeStats

Source§

impl PartialEq for ArcadeStats

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ArcadeStats

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ArcadeStats

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.