pub struct AwardReport {
pub requested_xp: u64,
pub accepted_xp: u64,
pub discarded_xp: u64,
pub saturated: bool,
pub level_before: u16,
pub level_after: u16,
pub promotions: u16,
pub xp_before: u64,
pub xp_spent: u64,
pub xp_after: u64,
pub at_cap: bool,
}Expand description
Exact result of applying the legacy saturating-add-then-promote rule.
Preview and commit return the same value if no state changes between them. Copies of reports are observations, not single-use reward tokens. Only the report returned by a new accepted award should drive rewards.
Using u128 arithmetic, xp_before + accepted_xp == xp_spent + xp_after.
accepted_xp is the delta admitted by the initial saturating addition, not
xp_after - xp_before, which may be negative after promotion costs.
Fields§
§requested_xp: u64XP requested by the caller.
accepted_xp: u64XP admitted before promotion subtraction; at most u64::MAX - xp_before.
discarded_xp: u64Requested XP discarded by saturation, even if promotions free room later.
saturated: boolWhether any requested XP was discarded. Exactly filling storage is false.
level_before: u16Level before this award.
level_after: u16Level after this award.
promotions: u16New promotions, bounded by 1023; zero when already at the cap.
xp_before: u64Retained XP before the initial addition.
xp_spent: u64Total XP subtracted for newly earned levels (not a lifetime total).
xp_after: u64Retained remainder after promotion subtraction; may be large at the cap.
at_cap: boolWhether level_after equals the authored maximum, including maximum 1.
Trait Implementations§
Source§impl Clone for AwardReport
impl Clone for AwardReport
Source§fn clone(&self) -> AwardReport
fn clone(&self) -> AwardReport
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more