// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.deckbelcher.deck.list // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. /// A card entry in a decklist. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Card<'a> { /// Number of copies in the deck. pub quantity: i64, /// Scryfall UUID for the specific printing. #[serde(borrow)] pub scryfall_id: jacquard_common::CowStr<'a>, /// Which section of the deck this card belongs to. Extensible to support format-specific sections. #[serde(borrow)] pub section: CardSection<'a>, /// User annotations for this card in this deck (e.g., "removal", "wincon", "ramp"). #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub tags: std::option::Option>>, } pub mod card_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Quantity; type ScryfallId; type Section; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Quantity = Unset; type ScryfallId = Unset; type Section = Unset; } ///State transition - sets the `quantity` field to Set pub struct SetQuantity(PhantomData S>); impl sealed::Sealed for SetQuantity {} impl State for SetQuantity { type Quantity = Set; type ScryfallId = S::ScryfallId; type Section = S::Section; } ///State transition - sets the `scryfall_id` field to Set pub struct SetScryfallId(PhantomData S>); impl sealed::Sealed for SetScryfallId {} impl State for SetScryfallId { type Quantity = S::Quantity; type ScryfallId = Set; type Section = S::Section; } ///State transition - sets the `section` field to Set pub struct SetSection(PhantomData S>); impl sealed::Sealed for SetSection {} impl State for SetSection { type Quantity = S::Quantity; type ScryfallId = S::ScryfallId; type Section = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `quantity` field pub struct quantity(()); ///Marker type for the `scryfall_id` field pub struct scryfall_id(()); ///Marker type for the `section` field pub struct section(()); } } /// Builder for constructing an instance of this type pub struct CardBuilder<'a, S: card_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Card<'a> { /// Create a new builder for this type pub fn new() -> CardBuilder<'a, card_state::Empty> { CardBuilder::new() } } impl<'a> CardBuilder<'a, card_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { CardBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CardBuilder<'a, S> where S: card_state::State, S::Quantity: card_state::IsUnset, { /// Set the `quantity` field (required) pub fn quantity( mut self, value: impl Into, ) -> CardBuilder<'a, card_state::SetQuantity> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); CardBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CardBuilder<'a, S> where S: card_state::State, S::ScryfallId: card_state::IsUnset, { /// Set the `scryfallId` field (required) pub fn scryfall_id( mut self, value: impl Into>, ) -> CardBuilder<'a, card_state::SetScryfallId> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); CardBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CardBuilder<'a, S> where S: card_state::State, S::Section: card_state::IsUnset, { /// Set the `section` field (required) pub fn section( mut self, value: impl Into>, ) -> CardBuilder<'a, card_state::SetSection> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); CardBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: card_state::State> CardBuilder<'a, S> { /// Set the `tags` field (optional) pub fn tags( mut self, value: impl Into>>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `tags` field to an Option value (optional) pub fn maybe_tags( mut self, value: Option>>, ) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S> CardBuilder<'a, S> where S: card_state::State, S::Quantity: card_state::IsSet, S::ScryfallId: card_state::IsSet, S::Section: card_state::IsSet, { /// Build the final struct pub fn build(self) -> Card<'a> { Card { quantity: self.__unsafe_private_named.0.unwrap(), scryfall_id: self.__unsafe_private_named.1.unwrap(), section: self.__unsafe_private_named.2.unwrap(), tags: self.__unsafe_private_named.3, extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> Card<'a> { Card { quantity: self.__unsafe_private_named.0.unwrap(), scryfall_id: self.__unsafe_private_named.1.unwrap(), section: self.__unsafe_private_named.2.unwrap(), tags: self.__unsafe_private_named.3, extra_data: Some(extra_data), } } } /// Which section of the deck this card belongs to. Extensible to support format-specific sections. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum CardSection<'a> { Mainboard, Sideboard, Maybeboard, Commander, Other(jacquard_common::CowStr<'a>), } impl<'a> CardSection<'a> { pub fn as_str(&self) -> &str { match self { Self::Mainboard => "mainboard", Self::Sideboard => "sideboard", Self::Maybeboard => "maybeboard", Self::Commander => "commander", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for CardSection<'a> { fn from(s: &'a str) -> Self { match s { "mainboard" => Self::Mainboard, "sideboard" => Self::Sideboard, "maybeboard" => Self::Maybeboard, "commander" => Self::Commander, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for CardSection<'a> { fn from(s: String) -> Self { match s.as_str() { "mainboard" => Self::Mainboard, "sideboard" => Self::Sideboard, "maybeboard" => Self::Maybeboard, "commander" => Self::Commander, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for CardSection<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for CardSection<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for CardSection<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for CardSection<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for CardSection<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for CardSection<'_> { type Output = CardSection<'static>; fn into_static(self) -> Self::Output { match self { CardSection::Mainboard => CardSection::Mainboard, CardSection::Sideboard => CardSection::Sideboard, CardSection::Maybeboard => CardSection::Maybeboard, CardSection::Commander => CardSection::Commander, CardSection::Other(v) => CardSection::Other(v.into_static()), } } } fn lexicon_doc_com_deckbelcher_deck_list() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("com.deckbelcher.deck.list"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("card"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "A card entry in a decklist.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("scryfallId"), ::jacquard_common::smol_str::SmolStr::new_static("quantity"), ::jacquard_common::smol_str::SmolStr::new_static("section") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("quantity"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: Some(1i64), maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "scryfallId", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Scryfall UUID for the specific printing.", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("section"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Which section of the deck this card belongs to. Extensible to support format-specific sections.", ), ), format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("tags"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( "User annotations for this card in this deck (e.g., \"removal\", \"wincon\", \"ramp\").", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "A tag annotation for a card.", ), ), format: None, default: None, min_length: None, max_length: Some(640usize), min_graphemes: None, max_graphemes: Some(64usize), r#enum: None, r#const: None, known_values: None, }), min_length: None, max_length: Some(128usize), }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { description: Some( ::jacquard_common::CowStr::new_static( "A Magic: The Gathering decklist.", ), ), key: Some(::jacquard_common::CowStr::new_static("tid")), record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_common::smol_str::SmolStr::new_static("cards"), ::jacquard_common::smol_str::SmolStr::new_static("createdAt") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cards"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( "Array of cards in the decklist.", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#card"), }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "createdAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Timestamp when the decklist was created.", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("format"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Format of the deck (e.g., \"commander\", \"cube\", \"pauper\").", ), ), format: None, default: None, min_length: None, max_length: Some(320usize), min_graphemes: None, max_graphemes: Some(32usize), r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Name of the decklist.", ), ), format: None, default: None, min_length: None, max_length: Some(1280usize), min_graphemes: None, max_graphemes: Some(128usize), r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("primer"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Deck primer with strategy, combos, and card choices.", ), ), format: None, default: None, min_length: None, max_length: Some(100000usize), min_graphemes: None, max_graphemes: Some(10000usize), r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "primerFacets", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: Some( ::jacquard_common::CowStr::new_static( "Annotations of text in the primer (mentions, URLs, hashtags, card references, etc).", ), ), items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static( "com.deckbelcher.richtext.facet", ), }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "updatedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Timestamp when the decklist was last updated.", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Card<'a> { fn nsid() -> &'static str { "com.deckbelcher.deck.list" } fn def_name() -> &'static str { "card" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_com_deckbelcher_deck_list() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.quantity; if *value < 1i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "quantity", ), min: 1i64, actual: *value, }); } } if let Some(ref value) = self.tags { #[allow(unused_comparisons)] if value.len() > 128usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "tags", ), max: 128usize, actual: value.len(), }); } } Ok(()) } } /// A Magic: The Gathering decklist. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct List<'a> { /// Array of cards in the decklist. #[serde(borrow)] pub cards: Vec>, /// Timestamp when the decklist was created. pub created_at: jacquard_common::types::string::Datetime, /// Format of the deck (e.g., "commander", "cube", "pauper"). #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub format: std::option::Option>, /// Name of the decklist. #[serde(borrow)] pub name: jacquard_common::CowStr<'a>, /// Deck primer with strategy, combos, and card choices. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub primer: std::option::Option>, /// Annotations of text in the primer (mentions, URLs, hashtags, card references, etc). #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub primer_facets: std::option::Option< Vec>, >, /// Timestamp when the decklist was last updated. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub updated_at: std::option::Option, } pub mod list_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type CreatedAt; type Name; type Cards; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type CreatedAt = Unset; type Name = Unset; type Cards = Unset; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type CreatedAt = Set; type Name = S::Name; type Cards = S::Cards; } ///State transition - sets the `name` field to Set pub struct SetName(PhantomData S>); impl sealed::Sealed for SetName {} impl State for SetName { type CreatedAt = S::CreatedAt; type Name = Set; type Cards = S::Cards; } ///State transition - sets the `cards` field to Set pub struct SetCards(PhantomData S>); impl sealed::Sealed for SetCards {} impl State for SetCards { type CreatedAt = S::CreatedAt; type Name = S::Name; type Cards = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `cards` field pub struct cards(()); } } /// Builder for constructing an instance of this type pub struct ListBuilder<'a, S: list_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> List<'a> { /// Create a new builder for this type pub fn new() -> ListBuilder<'a, list_state::Empty> { ListBuilder::new() } } impl<'a> ListBuilder<'a, list_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ListBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ListBuilder<'a, S> where S: list_state::State, S::Cards: list_state::IsUnset, { /// Set the `cards` field (required) pub fn cards( mut self, value: impl Into>>, ) -> ListBuilder<'a, list_state::SetCards> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ListBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ListBuilder<'a, S> where S: list_state::State, S::CreatedAt: list_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> ListBuilder<'a, list_state::SetCreatedAt> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); ListBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: list_state::State> ListBuilder<'a, S> { /// Set the `format` field (optional) pub fn format( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `format` field to an Option value (optional) pub fn maybe_format(mut self, value: Option>) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S> ListBuilder<'a, S> where S: list_state::State, S::Name: list_state::IsUnset, { /// Set the `name` field (required) pub fn name( mut self, value: impl Into>, ) -> ListBuilder<'a, list_state::SetName> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); ListBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: list_state::State> ListBuilder<'a, S> { /// Set the `primer` field (optional) pub fn primer( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `primer` field to an Option value (optional) pub fn maybe_primer(mut self, value: Option>) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S: list_state::State> ListBuilder<'a, S> { /// Set the `primerFacets` field (optional) pub fn primer_facets( mut self, value: impl Into>>>, ) -> Self { self.__unsafe_private_named.5 = value.into(); self } /// Set the `primerFacets` field to an Option value (optional) pub fn maybe_primer_facets( mut self, value: Option>>, ) -> Self { self.__unsafe_private_named.5 = value; self } } impl<'a, S: list_state::State> ListBuilder<'a, S> { /// Set the `updatedAt` field (optional) pub fn updated_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.6 = value.into(); self } /// Set the `updatedAt` field to an Option value (optional) pub fn maybe_updated_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.6 = value; self } } impl<'a, S> ListBuilder<'a, S> where S: list_state::State, S::CreatedAt: list_state::IsSet, S::Name: list_state::IsSet, S::Cards: list_state::IsSet, { /// Build the final struct pub fn build(self) -> List<'a> { List { cards: self.__unsafe_private_named.0.unwrap(), created_at: self.__unsafe_private_named.1.unwrap(), format: self.__unsafe_private_named.2, name: self.__unsafe_private_named.3.unwrap(), primer: self.__unsafe_private_named.4, primer_facets: self.__unsafe_private_named.5, updated_at: self.__unsafe_private_named.6, extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> List<'a> { List { cards: self.__unsafe_private_named.0.unwrap(), created_at: self.__unsafe_private_named.1.unwrap(), format: self.__unsafe_private_named.2, name: self.__unsafe_private_named.3.unwrap(), primer: self.__unsafe_private_named.4, primer_facets: self.__unsafe_private_named.5, updated_at: self.__unsafe_private_named.6, extra_data: Some(extra_data), } } } impl<'a> List<'a> { pub fn uri( uri: impl Into>, ) -> Result< jacquard_common::types::uri::RecordUri<'a, ListRecord>, jacquard_common::types::uri::UriError, > { jacquard_common::types::uri::RecordUri::try_from_uri( jacquard_common::types::string::AtUri::new_cow(uri.into())?, ) } } /// Typed wrapper for GetRecord response with this collection's record type. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ListGetRecordOutput<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cid: std::option::Option>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(borrow)] pub value: List<'a>, } impl From> for List<'_> { fn from(output: ListGetRecordOutput<'_>) -> Self { use jacquard_common::IntoStatic; output.value.into_static() } } impl jacquard_common::types::collection::Collection for List<'_> { const NSID: &'static str = "com.deckbelcher.deck.list"; type Record = ListRecord; } /// Marker type for deserializing records from this collection. #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct ListRecord; impl jacquard_common::xrpc::XrpcResp for ListRecord { const NSID: &'static str = "com.deckbelcher.deck.list"; const ENCODING: &'static str = "application/json"; type Output<'de> = ListGetRecordOutput<'de>; type Err<'de> = jacquard_common::types::collection::RecordError<'de>; } impl jacquard_common::types::collection::Collection for ListRecord { const NSID: &'static str = "com.deckbelcher.deck.list"; type Record = ListRecord; } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for List<'a> { fn nsid() -> &'static str { "com.deckbelcher.deck.list" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_com_deckbelcher_deck_list() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.format { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 320usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "format", ), max: 320usize, actual: ::len(value.as_ref()), }); } } if let Some(ref value) = self.format { { let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( value.as_ref(), true, ) .count(); if count > 32usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "format", ), max: 32usize, actual: count, }); } } } { let value = &self.name; #[allow(unused_comparisons)] if ::len(value.as_ref()) > 1280usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "name", ), max: 1280usize, actual: ::len(value.as_ref()), }); } } { let value = &self.name; { let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( value.as_ref(), true, ) .count(); if count > 128usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "name", ), max: 128usize, actual: count, }); } } } if let Some(ref value) = self.primer { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 100000usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "primer", ), max: 100000usize, actual: ::len(value.as_ref()), }); } } if let Some(ref value) = self.primer { { let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( value.as_ref(), true, ) .count(); if count > 10000usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "primer", ), max: 10000usize, actual: count, }); } } } Ok(()) } }