A better Rust ATProto crate
at main 2.4 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: blue.2048.game 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// A declaration of an instance of a at://2048 game 9#[jacquard_derive::lexicon] 10#[derive( 11 serde::Serialize, 12 serde::Deserialize, 13 Debug, 14 Clone, 15 PartialEq, 16 Eq, 17 jacquard_derive::IntoStatic, 18 bon::Builder 19)] 20#[serde(rename_all = "camelCase")] 21pub struct Game<'a> { 22 /// The player no longer has any moves left 23 pub completed: bool, 24 pub created_at: jacquard_common::types::string::Datetime, 25 /// The game's current score 26 pub current_score: i64, 27 /// This is the recording of the game. Like chess notation, but for 2048 28 #[serde(borrow)] 29 #[builder(into)] 30 pub seeded_recording: jacquard_common::CowStr<'a>, 31 /// The sync status of this record with the users AT Protocol repo. 32 #[serde(borrow)] 33 pub sync_status: crate::blue__2048::SyncStatus<'a>, 34 /// The player has found a 2048 tile (they have won) 35 pub won: bool, 36} 37 38/// Typed wrapper for GetRecord response with this collection's record type. 39#[derive( 40 serde::Serialize, 41 serde::Deserialize, 42 Debug, 43 Clone, 44 PartialEq, 45 Eq, 46 jacquard_derive::IntoStatic 47)] 48#[serde(rename_all = "camelCase")] 49pub struct GameGetRecordOutput<'a> { 50 #[serde(skip_serializing_if = "std::option::Option::is_none")] 51 #[serde(borrow)] 52 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 53 #[serde(borrow)] 54 pub uri: jacquard_common::types::string::AtUri<'a>, 55 #[serde(borrow)] 56 pub value: Game<'a>, 57} 58 59/// Marker type for deserializing records from this collection. 60pub struct GameRecord; 61impl jacquard_common::xrpc::XrpcResp for GameRecord { 62 const NSID: &'static str = "blue.2048.game"; 63 const ENCODING: &'static str = "application/json"; 64 type Output<'de> = GameGetRecordOutput<'de>; 65 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 66} 67 68impl jacquard_common::types::collection::Collection for Game<'_> { 69 const NSID: &'static str = "blue.2048.game"; 70 type Record = GameRecord; 71} 72 73impl From<GameGetRecordOutput<'_>> for Game<'_> { 74 fn from(output: GameGetRecordOutput<'_>) -> Self { 75 use jacquard_common::IntoStatic; 76 output.value.into_static() 77 } 78}