Struct mojang::Stats[][src]

pub struct Stats {
    pub metrics: Vec<MetricKeys>,
    pub total: u32,
    pub last24h: u32,
    pub sale_per_sec: f32,
}
Expand description

Stats Response

Example

// Import Lib
use mojang::Stats;

// Get Stats
let s = Stats::new().unwrap();

println!("Total Minecraft Sales: {}", s.total);
println!("Minecraft Sales 24h: {}", s.last24h);
println!("Minecraft Sales / Sec: {}", s.sale_per_sec);

Fields

metrics: Vec<MetricKeys>

Metrics In the Response

total: u32

Total Sales

last24h: u32

Sales in the last day

sale_per_sec: f32

Sales per Second

Implementations

Fetch Stats with default Metrics

Default Metrics: [ItemSoldMinecraft, PrepaidCardRedeemedMinecraft]

Example
// Import Lib
use mojang::Stats;

// Get Stats
let s = Stats::new().unwrap();

s.total;
s.last24h;
s.sale_per_sec;

Fetch stats with set metrics

Example
// Import Lib
use mojang::Stats;
use mojang::MetricKeys;

let s = Stats::new_metrics(vec![MetricKeys::ItemSoldMinecraft]).unwrap();

s.total;
s.last24h;
s.sale_per_sec;

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.