pub struct Progress<S: BosStr = DefaultStr> {
pub created_at: Datetime,
pub level: i64,
pub progress_percentage: Option<S>,
pub signature: ChronicleSignature<S>,
pub total_xp: i64,
pub trigger_source: Option<S>,
pub updated_at: Option<Datetime>,
pub xp_gained_since_last_sign: Option<i64>,
pub xp_to_next_level: Option<i64>,
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}Expand description
Signed player progression state. Singleton (rkey: self), overwritten via putRecord. Backend validates XP claims before signing.
Fields§
§created_at: DatetimeWhen the record was first created
level: i64Current player level (derived from XP table)
progress_percentage: Option<S>Progress toward next level as decimal string
signature: ChronicleSignature<S>§total_xp: i64Total accumulated XP
trigger_source: Option<S>What triggered this save (level_up, session_end, visibility_hidden, periodic, card_advance)
updated_at: Option<Datetime>When the record was last updated
xp_gained_since_last_sign: Option<i64>XP gained since the last signed progress record (for rate validation against daily activity)
xp_to_next_level: Option<i64>XP remaining to reach next level
extra_data: Option<BTreeMap<SmolStr, Data<S>>>Implementations§
Source§impl Progress<DefaultStr>
impl Progress<DefaultStr>
Sourcepub fn new() -> ProgressBuilder<Empty, DefaultStr>
pub fn new() -> ProgressBuilder<Empty, DefaultStr>
Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
Trait Implementations§
Source§impl<S: BosStr> Collection for Progress<S>
impl<S: BosStr> Collection for Progress<S>
Source§const NSID: &'static str = "net.anisota.chronicle.progress"
const NSID: &'static str = "net.anisota.chronicle.progress"
The NSID for the Lexicon that defines the schema of records in this collection.
Source§type Record = ProgressRecord
type Record = ProgressRecord
A marker type implementing
XrpcResp that allows typed deserialization of records
from this collection. Used by AgentSessionExt::get_record to return properly typed responses.Source§impl<'de, S> Deserialize<'de> for Progress<S>where
S: Deserialize<'de> + BosStr,
impl<'de, S> Deserialize<'de> for Progress<S>where
S: Deserialize<'de> + BosStr,
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<S: Eq + BosStr> Eq for Progress<S>
Source§impl<S: BosStr> From<ProgressGetRecordOutput<S>> for Progress<S>
impl<S: BosStr> From<ProgressGetRecordOutput<S>> for Progress<S>
Source§fn from(output: ProgressGetRecordOutput<S>) -> Self
fn from(output: ProgressGetRecordOutput<S>) -> Self
Converts to this type from the input type.
Source§impl<S: BosStr + IntoStatic> IntoStatic for Progress<S>
impl<S: BosStr + IntoStatic> IntoStatic for Progress<S>
Source§impl<S: BosStr> LexiconSchema for Progress<S>
impl<S: BosStr> LexiconSchema for Progress<S>
Source§fn lexicon_doc() -> LexiconDoc<'static>
fn lexicon_doc() -> LexiconDoc<'static>
Generate the lexicon document for this type Read more
Source§fn validate(&self) -> Result<(), ConstraintError>
fn validate(&self) -> Result<(), ConstraintError>
Validate an instance against lexicon constraints Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether this type should be inlined vs referenced Read more
Source§impl<S: PartialEq + BosStr> PartialEq for Progress<S>
impl<S: PartialEq + BosStr> PartialEq for Progress<S>
impl<S: PartialEq + BosStr> StructuralPartialEq for Progress<S>
Auto Trait Implementations§
impl<S> Freeze for Progress<S>where
S: Freeze,
impl<S> RefUnwindSafe for Progress<S>where
S: RefUnwindSafe,
impl<S> Send for Progress<S>where
S: Send,
impl<S> Sync for Progress<S>where
S: Sync,
impl<S> Unpin for Progress<S>where
S: Unpin,
impl<S> UnsafeUnpin for Progress<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Progress<S>where
S: UnwindSafe + RefUnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.