Rust wrapper for the ATProto tap utility

Update lexicons

+734 -506
+58 -47
lexicons-example/lexicons/site.standard.document.json
··· 1 { 2 "defs": { 3 "main": { 4 "key": "tid", 5 "record": { 6 "properties": { 7 - "bskyPostRef": { 8 - "ref": "com.atproto.repo.strongRef", 9 - "type": "ref" 10 }, 11 "content": { 12 - "closed": false, 13 "refs": [], 14 - "type": "union" 15 }, 16 "coverImage": { 17 "accept": [ 18 "image/*" 19 ], 20 "maxSize": 1000000, 21 - "type": "blob" 22 }, 23 "description": { 24 - "maxGraphemes": 300, 25 - "maxLength": 3000, 26 - "type": "string" 27 - }, 28 - "path": { 29 - "description": "combine with the publication url or the document site to construct a full url to the document", 30 - "type": "string" 31 }, 32 "publishedAt": { 33 "format": "datetime", 34 - "type": "string" 35 - }, 36 - "site": { 37 - "description": "URI to the site or publication this document belongs to (https or at-uri)", 38 - "format": "uri", 39 - "type": "string" 40 - }, 41 - "tags": { 42 - "items": { 43 - "maxGraphemes": 50, 44 - "maxLength": 100, 45 - "type": "string" 46 - }, 47 - "type": "array" 48 }, 49 "textContent": { 50 - "type": "string" 51 - }, 52 - "title": { 53 - "maxGraphemes": 128, 54 - "maxLength": 1280, 55 - "type": "string" 56 - }, 57 - "updatedAt": { 58 - "format": "datetime", 59 - "type": "string" 60 } 61 - }, 62 - "required": [ 63 - "site", 64 - "title", 65 - "publishedAt" 66 - ], 67 - "type": "object" 68 }, 69 - "type": "record" 70 } 71 }, 72 - "id": "site.standard.document", 73 "lexicon": 1 74 - }
··· 1 { 2 + "id": "site.standard.document", 3 "defs": { 4 "main": { 5 "key": "tid", 6 + "type": "record", 7 "record": { 8 + "type": "object", 9 + "required": [ 10 + "site", 11 + "title", 12 + "publishedAt" 13 + ], 14 "properties": { 15 + "path": { 16 + "type": "string", 17 + "description": "Combine with site or publication url to construct a canonical URL to the document. Prepend with a leading slash." 18 + }, 19 + "site": { 20 + "type": "string", 21 + "format": "uri", 22 + "description": "Points to a publication record (at://) or a publication url (https://) for loose documents. Avoid trailing slashes." 23 + }, 24 + "tags": { 25 + "type": "array", 26 + "items": { 27 + "type": "string", 28 + "maxLength": 1280, 29 + "maxGraphemes": 128 30 + }, 31 + "description": "Array of strings used to tag or categorize the document. Avoid prepending tags with hashtags." 32 + }, 33 + "title": { 34 + "type": "string", 35 + "maxLength": 5000, 36 + "description": "Title of the document.", 37 + "maxGraphemes": 500 38 }, 39 "content": { 40 "refs": [], 41 + "type": "union", 42 + "closed": false, 43 + "description": "Open union used to define the record's content. Each entry must specify a $type and may be extended with other lexicons to support additional content formats." 44 + }, 45 + "updatedAt": { 46 + "type": "string", 47 + "format": "datetime", 48 + "description": "Timestamp of the documents last edit." 49 }, 50 "coverImage": { 51 + "type": "blob", 52 "accept": [ 53 "image/*" 54 ], 55 "maxSize": 1000000, 56 + "description": "Image to used for thumbnail or cover image. Less than 1MB is size." 57 + }, 58 + "bskyPostRef": { 59 + "ref": "com.atproto.repo.strongRef", 60 + "type": "ref", 61 + "description": "Strong reference to a Bluesky post. Useful to keep track of comments off-platform." 62 }, 63 "description": { 64 + "type": "string", 65 + "maxLength": 30000, 66 + "description": "A brief description or excerpt from the document.", 67 + "maxGraphemes": 3000 68 }, 69 "publishedAt": { 70 + "type": "string", 71 "format": "datetime", 72 + "description": "Timestamp of the documents publish time." 73 }, 74 "textContent": { 75 + "type": "string", 76 + "description": "Plaintext representation of the documents contents. Should not contain markdown or other formatting." 77 } 78 + } 79 }, 80 + "description": "A document record representing a published article, blog post, or other content. Documents can belong to a publication or exist independently." 81 } 82 }, 83 + "$type": "com.atproto.lexicon.schema", 84 "lexicon": 1 85 + }
+38 -28
lexicons-example/lexicons/site.standard.publication.json
··· 1 { 2 "defs": { 3 "main": { 4 "key": "tid", 5 "record": { 6 "properties": { 7 - "basicTheme": { 8 - "ref": "site.standard.theme.basic", 9 - "type": "ref" 10 - }, 11 - "description": { 12 - "maxGraphemes": 300, 13 - "maxLength": 3000, 14 - "type": "string" 15 }, 16 "icon": { 17 "accept": [ 18 "image/*" 19 ], 20 "maxSize": 1000000, 21 - "type": "blob" 22 }, 23 "name": { 24 - "maxGraphemes": 128, 25 - "maxLength": 1280, 26 - "type": "string" 27 }, 28 "preferences": { 29 "ref": "#preferences", 30 - "type": "ref" 31 - }, 32 - "url": { 33 - "format": "uri", 34 - "type": "string" 35 } 36 - }, 37 - "required": [ 38 - "url", 39 - "name" 40 - ], 41 - "type": "object" 42 }, 43 - "type": "record" 44 }, 45 "preferences": { 46 "properties": { 47 "showInDiscover": { 48 "default": true, 49 - "type": "boolean" 50 } 51 }, 52 - "type": "object" 53 } 54 }, 55 - "id": "site.standard.publication", 56 "lexicon": 1 57 - }
··· 1 { 2 + "id": "site.standard.publication", 3 "defs": { 4 "main": { 5 "key": "tid", 6 + "type": "record", 7 "record": { 8 + "type": "object", 9 + "required": [ 10 + "url", 11 + "name" 12 + ], 13 "properties": { 14 + "url": { 15 + "type": "string", 16 + "format": "uri", 17 + "description": "Base publication url (ex: https://standard.site). The canonical document URL is formed by combining this value with the document path." 18 }, 19 "icon": { 20 + "type": "blob", 21 "accept": [ 22 "image/*" 23 ], 24 "maxSize": 1000000, 25 + "description": "Square image to identify the publication. Should be at least 256x256." 26 }, 27 "name": { 28 + "type": "string", 29 + "maxLength": 5000, 30 + "description": "Name of the publication.", 31 + "maxGraphemes": 500 32 + }, 33 + "basicTheme": { 34 + "ref": "site.standard.theme.basic", 35 + "type": "ref", 36 + "description": "Simplified publication theme for tools and apps to utilize when displaying content." 37 + }, 38 + "description": { 39 + "type": "string", 40 + "maxLength": 30000, 41 + "description": "Brief description of the publication.", 42 + "maxGraphemes": 3000 43 }, 44 "preferences": { 45 "ref": "#preferences", 46 + "type": "ref", 47 + "description": "Object containing platform specific preferences (with a few shared properties)." 48 } 49 + } 50 }, 51 + "description": "A publication record representing a blog, website, or content platform. Publications serve as containers for documents and define the overall branding and settings." 52 }, 53 "preferences": { 54 + "type": "object", 55 "properties": { 56 "showInDiscover": { 57 + "type": "boolean", 58 "default": true, 59 + "description": "Boolean which decides whether the publication should appear in discovery feeds." 60 } 61 }, 62 + "description": "Platform-specific preferences for the publication, including discovery and visibility settings." 63 } 64 }, 65 + "$type": "com.atproto.lexicon.schema", 66 "lexicon": 1 67 + }
+1 -1
lexicons-example/src/builder_types.rs
··· 40 pub trait Sealed {} 41 impl<T> Sealed for super::Set<T> {} 42 impl Sealed for super::Unset {} 43 - }
··· 40 pub trait Sealed {} 41 impl<T> Sealed for super::Set<T> {} 42 impl Sealed for super::Unset {} 43 + }
+1 -1
lexicons-example/src/com_atproto.rs
··· 3 // This file was automatically generated from Lexicon schemas. 4 // Any manual changes will be overwritten on the next regeneration. 5 6 - pub mod repo;
··· 3 // This file was automatically generated from Lexicon schemas. 4 // Any manual changes will be overwritten on the next regeneration. 5 6 + pub mod repo;
+1 -1
lexicons-example/src/com_atproto/repo.rs
··· 3 // This file was automatically generated from Lexicon schemas. 4 // Any manual changes will be overwritten on the next regeneration. 5 6 - pub mod strong_ref;
··· 3 // This file was automatically generated from Lexicon schemas. 4 // Any manual changes will be overwritten on the next regeneration. 5 6 + pub mod strong_ref;
+69 -65
lexicons-example/src/com_atproto/repo/strong_ref.rs
··· 7 8 #[jacquard_derive::lexicon] 9 #[derive( 10 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 11 )] 12 #[serde(rename_all = "camelCase")] 13 pub struct StrongRef<'a> { ··· 19 20 pub mod strong_ref_state { 21 22 - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; 23 #[allow(unused)] 24 use ::core::marker::PhantomData; 25 mod sealed { ··· 27 } 28 /// State trait tracking which required fields have been set 29 pub trait State: sealed::Sealed { 30 - type Uri; 31 type Cid; 32 } 33 /// Empty state - all required fields are unset 34 pub struct Empty(()); 35 impl sealed::Sealed for Empty {} 36 impl State for Empty { 37 - type Uri = Unset; 38 type Cid = Unset; 39 - } 40 - ///State transition - sets the `uri` field to Set 41 - pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 42 - impl<S: State> sealed::Sealed for SetUri<S> {} 43 - impl<S: State> State for SetUri<S> { 44 - type Uri = Set<members::uri>; 45 - type Cid = S::Cid; 46 } 47 ///State transition - sets the `cid` field to Set 48 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); 49 impl<S: State> sealed::Sealed for SetCid<S> {} 50 impl<S: State> State for SetCid<S> { 51 type Uri = S::Uri; 52 - type Cid = Set<members::cid>; 53 } 54 /// Marker types for field names 55 #[allow(non_camel_case_types)] 56 pub mod members { 57 ///Marker type for the `uri` field 58 pub struct uri(()); 59 - ///Marker type for the `cid` field 60 - pub struct cid(()); 61 } 62 } 63 ··· 130 impl<'a, S> StrongRefBuilder<'a, S> 131 where 132 S: strong_ref_state::State, 133 - S::Uri: strong_ref_state::IsSet, 134 S::Cid: strong_ref_state::IsSet, 135 { 136 /// Build the final struct 137 pub fn build(self) -> StrongRef<'a> { ··· 157 } 158 } 159 160 - fn lexicon_doc_com_atproto_repo_strongRef() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 161 ::jacquard_lexicon::lexicon::LexiconDoc { 162 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 163 id: ::jacquard_common::CowStr::new_static("com.atproto.repo.strongRef"), ··· 167 let mut map = ::std::collections::BTreeMap::new(); 168 map.insert( 169 ::jacquard_common::smol_str::SmolStr::new_static("main"), 170 - ::jacquard_lexicon::lexicon::LexUserType::Object( 171 - ::jacquard_lexicon::lexicon::LexObject { 172 - description: None, 173 - required: Some(vec![ 174 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 175 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 176 - ]), 177 - nullable: None, 178 - properties: { 179 - #[allow(unused_mut)] 180 - let mut map = ::std::collections::BTreeMap::new(); 181 - map.insert( 182 - ::jacquard_common::smol_str::SmolStr::new_static("cid"), 183 - ::jacquard_lexicon::lexicon::LexObjectProperty::String( 184 - ::jacquard_lexicon::lexicon::LexString { 185 - description: None, 186 - format: Some( 187 - ::jacquard_lexicon::lexicon::LexStringFormat::Cid, 188 - ), 189 - default: None, 190 - min_length: None, 191 - max_length: None, 192 - min_graphemes: None, 193 - max_graphemes: None, 194 - r#enum: None, 195 - r#const: None, 196 - known_values: None, 197 - }, 198 ), 199 - ); 200 - map.insert( 201 - ::jacquard_common::smol_str::SmolStr::new_static("uri"), 202 - ::jacquard_lexicon::lexicon::LexObjectProperty::String( 203 - ::jacquard_lexicon::lexicon::LexString { 204 - description: None, 205 - format: Some( 206 - ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 207 - ), 208 - default: None, 209 - min_length: None, 210 - max_length: None, 211 - min_graphemes: None, 212 - max_graphemes: None, 213 - r#enum: None, 214 - r#const: None, 215 - known_values: None, 216 - }, 217 ), 218 - ); 219 - map 220 - }, 221 }, 222 - ), 223 ); 224 map 225 }, ··· 241 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 242 Ok(()) 243 } 244 - }
··· 7 8 #[jacquard_derive::lexicon] 9 #[derive( 10 + serde::Serialize, 11 + serde::Deserialize, 12 + Debug, 13 + Clone, 14 + PartialEq, 15 + Eq, 16 + jacquard_derive::IntoStatic 17 )] 18 #[serde(rename_all = "camelCase")] 19 pub struct StrongRef<'a> { ··· 25 26 pub mod strong_ref_state { 27 28 + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 29 #[allow(unused)] 30 use ::core::marker::PhantomData; 31 mod sealed { ··· 33 } 34 /// State trait tracking which required fields have been set 35 pub trait State: sealed::Sealed { 36 type Cid; 37 + type Uri; 38 } 39 /// Empty state - all required fields are unset 40 pub struct Empty(()); 41 impl sealed::Sealed for Empty {} 42 impl State for Empty { 43 type Cid = Unset; 44 + type Uri = Unset; 45 } 46 ///State transition - sets the `cid` field to Set 47 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); 48 impl<S: State> sealed::Sealed for SetCid<S> {} 49 impl<S: State> State for SetCid<S> { 50 + type Cid = Set<members::cid>; 51 type Uri = S::Uri; 52 + } 53 + ///State transition - sets the `uri` field to Set 54 + pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 55 + impl<S: State> sealed::Sealed for SetUri<S> {} 56 + impl<S: State> State for SetUri<S> { 57 + type Cid = S::Cid; 58 + type Uri = Set<members::uri>; 59 } 60 /// Marker types for field names 61 #[allow(non_camel_case_types)] 62 pub mod members { 63 + ///Marker type for the `cid` field 64 + pub struct cid(()); 65 ///Marker type for the `uri` field 66 pub struct uri(()); 67 } 68 } 69 ··· 136 impl<'a, S> StrongRefBuilder<'a, S> 137 where 138 S: strong_ref_state::State, 139 S::Cid: strong_ref_state::IsSet, 140 + S::Uri: strong_ref_state::IsSet, 141 { 142 /// Build the final struct 143 pub fn build(self) -> StrongRef<'a> { ··· 163 } 164 } 165 166 + fn lexicon_doc_com_atproto_repo_strongRef() -> ::jacquard_lexicon::lexicon::LexiconDoc< 167 + 'static, 168 + > { 169 ::jacquard_lexicon::lexicon::LexiconDoc { 170 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 171 id: ::jacquard_common::CowStr::new_static("com.atproto.repo.strongRef"), ··· 175 let mut map = ::std::collections::BTreeMap::new(); 176 map.insert( 177 ::jacquard_common::smol_str::SmolStr::new_static("main"), 178 + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 179 + description: None, 180 + required: Some( 181 + vec![ 182 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 183 + ::jacquard_common::smol_str::SmolStr::new_static("cid") 184 + ], 185 + ), 186 + nullable: None, 187 + properties: { 188 + #[allow(unused_mut)] 189 + let mut map = ::std::collections::BTreeMap::new(); 190 + map.insert( 191 ::jacquard_common::smol_str::SmolStr::new_static("cid"), 192 + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 193 + description: None, 194 + format: Some( 195 + ::jacquard_lexicon::lexicon::LexStringFormat::Cid, 196 ), 197 + default: None, 198 + min_length: None, 199 + max_length: None, 200 + min_graphemes: None, 201 + max_graphemes: None, 202 + r#enum: None, 203 + r#const: None, 204 + known_values: None, 205 + }), 206 + ); 207 + map.insert( 208 + ::jacquard_common::smol_str::SmolStr::new_static("uri"), 209 + ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 210 + description: None, 211 + format: Some( 212 + ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 213 ), 214 + default: None, 215 + min_length: None, 216 + max_length: None, 217 + min_graphemes: None, 218 + max_graphemes: None, 219 + r#enum: None, 220 + r#const: None, 221 + known_values: None, 222 + }), 223 + ); 224 + map 225 }, 226 + }), 227 ); 228 map 229 }, ··· 245 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 246 Ok(()) 247 } 248 + }
+1 -1
lexicons-example/src/lib.rs
··· 9 pub mod com_atproto; 10 11 #[cfg(feature = "site_standard")] 12 - pub mod site_standard;
··· 9 pub mod com_atproto; 10 11 #[cfg(feature = "site_standard")] 12 + pub mod site_standard;
+1 -1
lexicons-example/src/site_standard.rs
··· 6 pub mod document; 7 pub mod graph; 8 pub mod publication; 9 - pub mod theme;
··· 6 pub mod document; 7 pub mod graph; 8 pub mod publication; 9 + pub mod theme;
+176 -80
lexicons-example/src/site_standard/document.rs
··· 5 // This file was automatically generated from Lexicon schemas. 6 // Any manual changes will be overwritten on the next regeneration. 7 8 #[jacquard_derive::lexicon] 9 #[derive( 10 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 11 )] 12 #[serde(rename_all = "camelCase")] 13 pub struct Document<'a> { 14 #[serde(skip_serializing_if = "std::option::Option::is_none")] 15 #[serde(borrow)] 16 - pub bsky_post_ref: std::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>, 17 #[serde(skip_serializing_if = "std::option::Option::is_none")] 18 #[serde(borrow)] 19 pub content: std::option::Option<jacquard_common::types::value::Data<'a>>, 20 #[serde(skip_serializing_if = "std::option::Option::is_none")] 21 #[serde(borrow)] 22 pub cover_image: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, 23 #[serde(skip_serializing_if = "std::option::Option::is_none")] 24 #[serde(borrow)] 25 pub description: std::option::Option<jacquard_common::CowStr<'a>>, 26 - /// combine with the publication url or the document site to construct a full url to the document 27 #[serde(skip_serializing_if = "std::option::Option::is_none")] 28 #[serde(borrow)] 29 pub path: std::option::Option<jacquard_common::CowStr<'a>>, 30 pub published_at: jacquard_common::types::string::Datetime, 31 - /// URI to the site or publication this document belongs to (https or at-uri) 32 #[serde(borrow)] 33 pub site: jacquard_common::types::string::Uri<'a>, 34 #[serde(skip_serializing_if = "std::option::Option::is_none")] 35 #[serde(borrow)] 36 pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, 37 #[serde(skip_serializing_if = "std::option::Option::is_none")] 38 #[serde(borrow)] 39 pub text_content: std::option::Option<jacquard_common::CowStr<'a>>, 40 #[serde(borrow)] 41 pub title: jacquard_common::CowStr<'a>, 42 #[serde(skip_serializing_if = "std::option::Option::is_none")] 43 pub updated_at: std::option::Option<jacquard_common::types::string::Datetime>, 44 } 45 46 pub mod document_state { 47 48 - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; 49 #[allow(unused)] 50 use ::core::marker::PhantomData; 51 mod sealed { ··· 53 } 54 /// State trait tracking which required fields have been set 55 pub trait State: sealed::Sealed { 56 type Title; 57 type Site; 58 - type PublishedAt; 59 } 60 /// Empty state - all required fields are unset 61 pub struct Empty(()); 62 impl sealed::Sealed for Empty {} 63 impl State for Empty { 64 type Title = Unset; 65 type Site = Unset; 66 - type PublishedAt = Unset; 67 } 68 ///State transition - sets the `title` field to Set 69 pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); 70 impl<S: State> sealed::Sealed for SetTitle<S> {} 71 impl<S: State> State for SetTitle<S> { 72 type Title = Set<members::title>; 73 type Site = S::Site; 74 - type PublishedAt = S::PublishedAt; 75 } 76 ///State transition - sets the `site` field to Set 77 pub struct SetSite<S: State = Empty>(PhantomData<fn() -> S>); 78 impl<S: State> sealed::Sealed for SetSite<S> {} 79 impl<S: State> State for SetSite<S> { 80 - type Title = S::Title; 81 - type Site = Set<members::site>; 82 type PublishedAt = S::PublishedAt; 83 - } 84 - ///State transition - sets the `published_at` field to Set 85 - pub struct SetPublishedAt<S: State = Empty>(PhantomData<fn() -> S>); 86 - impl<S: State> sealed::Sealed for SetPublishedAt<S> {} 87 - impl<S: State> State for SetPublishedAt<S> { 88 type Title = S::Title; 89 - type Site = S::Site; 90 - type PublishedAt = Set<members::published_at>; 91 } 92 /// Marker types for field names 93 #[allow(non_camel_case_types)] 94 pub mod members { 95 ///Marker type for the `title` field 96 pub struct title(()); 97 ///Marker type for the `site` field 98 pub struct site(()); 99 - ///Marker type for the `published_at` field 100 - pub struct published_at(()); 101 } 102 } 103 ··· 133 DocumentBuilder { 134 _phantom_state: ::core::marker::PhantomData, 135 __unsafe_private_named: ( 136 - None, None, None, None, None, None, None, None, None, None, None, 137 ), 138 _phantom: ::core::marker::PhantomData, 139 } ··· 169 self 170 } 171 /// Set the `content` field to an Option value (optional) 172 - pub fn maybe_content(mut self, value: Option<jacquard_common::types::value::Data<'a>>) -> Self { 173 self.__unsafe_private_named.1 = value; 174 self 175 } ··· 196 197 impl<'a, S: document_state::State> DocumentBuilder<'a, S> { 198 /// Set the `description` field (optional) 199 - pub fn description(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self { 200 self.__unsafe_private_named.3 = value.into(); 201 self 202 } 203 /// Set the `description` field to an Option value (optional) 204 - pub fn maybe_description(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 205 self.__unsafe_private_named.3 = value; 206 self 207 } ··· 209 210 impl<'a, S: document_state::State> DocumentBuilder<'a, S> { 211 /// Set the `path` field (optional) 212 - pub fn path(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self { 213 self.__unsafe_private_named.4 = value.into(); 214 self 215 } ··· 260 261 impl<'a, S: document_state::State> DocumentBuilder<'a, S> { 262 /// Set the `tags` field (optional) 263 - pub fn tags(mut self, value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>) -> Self { 264 self.__unsafe_private_named.7 = value.into(); 265 self 266 } 267 /// Set the `tags` field to an Option value (optional) 268 - pub fn maybe_tags(mut self, value: Option<Vec<jacquard_common::CowStr<'a>>>) -> Self { 269 self.__unsafe_private_named.7 = value; 270 self 271 } ··· 273 274 impl<'a, S: document_state::State> DocumentBuilder<'a, S> { 275 /// Set the `textContent` field (optional) 276 - pub fn text_content(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self { 277 self.__unsafe_private_named.8 = value.into(); 278 self 279 } 280 /// Set the `textContent` field to an Option value (optional) 281 - pub fn maybe_text_content(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 282 self.__unsafe_private_named.8 = value; 283 self 284 } ··· 325 impl<'a, S> DocumentBuilder<'a, S> 326 where 327 S: document_state::State, 328 S::Title: document_state::IsSet, 329 S::Site: document_state::IsSet, 330 - S::PublishedAt: document_state::IsSet, 331 { 332 /// Build the final struct 333 pub fn build(self) -> Document<'a> { ··· 386 387 /// Typed wrapper for GetRecord response with this collection's record type. 388 #[derive( 389 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 390 )] 391 #[serde(rename_all = "camelCase")] 392 pub struct DocumentGetRecordOutput<'a> { ··· 441 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 442 if let Some(ref value) = self.description { 443 #[allow(unused_comparisons)] 444 - if <str>::len(value.as_ref()) > 3000usize { 445 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 446 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("description"), 447 - max: 3000usize, 448 actual: <str>::len(value.as_ref()), 449 }); 450 } 451 } 452 if let Some(ref value) = self.description { 453 { 454 - let count = 455 - ::unicode_segmentation::UnicodeSegmentation::graphemes(value.as_ref(), true) 456 - .count(); 457 - if count > 300usize { 458 - return Err( 459 - ::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 460 - path: ::jacquard_lexicon::validation::ValidationPath::from_field( 461 - "description", 462 - ), 463 - max: 300usize, 464 - actual: count, 465 - }, 466 - ); 467 } 468 } 469 } 470 { 471 let value = &self.title; 472 #[allow(unused_comparisons)] 473 - if <str>::len(value.as_ref()) > 1280usize { 474 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 475 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("title"), 476 - max: 1280usize, 477 actual: <str>::len(value.as_ref()), 478 }); 479 } ··· 481 { 482 let value = &self.title; 483 { 484 - let count = 485 - ::unicode_segmentation::UnicodeSegmentation::graphemes(value.as_ref(), true) 486 - .count(); 487 - if count > 128usize { 488 - return Err( 489 - ::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 490 - path: ::jacquard_lexicon::validation::ValidationPath::from_field( 491 - "title", 492 - ), 493 - max: 128usize, 494 - actual: count, 495 - }, 496 - ); 497 } 498 } 499 } ··· 501 } 502 } 503 504 - fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 505 ::jacquard_lexicon::lexicon::LexiconDoc { 506 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 507 id: ::jacquard_common::CowStr::new_static("site.standard.document"), ··· 512 map.insert( 513 ::jacquard_common::smol_str::SmolStr::new_static("main"), 514 ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { 515 - description: None, 516 key: Some(::jacquard_common::CowStr::new_static("tid")), 517 record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { 518 description: None, ··· 541 map.insert( 542 ::jacquard_common::smol_str::SmolStr::new_static("content"), 543 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { 544 - description: None, 545 refs: vec![], 546 closed: Some(false), 547 }), ··· 561 "description", 562 ), 563 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 564 - description: None, 565 format: None, 566 default: None, 567 min_length: None, 568 - max_length: Some(3000usize), 569 min_graphemes: None, 570 - max_graphemes: Some(300usize), 571 r#enum: None, 572 r#const: None, 573 known_values: None, ··· 578 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 579 description: Some( 580 ::jacquard_common::CowStr::new_static( 581 - "combine with the publication url or the document site to construct a full url to the document", 582 ), 583 ), 584 format: None, ··· 597 "publishedAt", 598 ), 599 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 600 - description: None, 601 format: Some( 602 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 603 ), ··· 616 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 617 description: Some( 618 ::jacquard_common::CowStr::new_static( 619 - "URI to the site or publication this document belongs to (https or at-uri)", 620 ), 621 ), 622 format: Some( ··· 635 map.insert( 636 ::jacquard_common::smol_str::SmolStr::new_static("tags"), 637 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 638 - description: None, 639 items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { 640 description: None, 641 format: None, 642 default: None, 643 min_length: None, 644 - max_length: Some(100usize), 645 min_graphemes: None, 646 - max_graphemes: Some(50usize), 647 r#enum: None, 648 r#const: None, 649 known_values: None, ··· 657 "textContent", 658 ), 659 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 660 - description: None, 661 format: None, 662 default: None, 663 min_length: None, ··· 672 map.insert( 673 ::jacquard_common::smol_str::SmolStr::new_static("title"), 674 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 675 - description: None, 676 format: None, 677 default: None, 678 min_length: None, 679 - max_length: Some(1280usize), 680 min_graphemes: None, 681 - max_graphemes: Some(128usize), 682 r#enum: None, 683 r#const: None, 684 known_values: None, ··· 689 "updatedAt", 690 ), 691 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 692 - description: None, 693 format: Some( 694 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 695 ), ··· 711 map 712 }, 713 } 714 - }
··· 5 // This file was automatically generated from Lexicon schemas. 6 // Any manual changes will be overwritten on the next regeneration. 7 8 + /// A document record representing a published article, blog post, or other content. Documents can belong to a publication or exist independently. 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 )] 19 #[serde(rename_all = "camelCase")] 20 pub struct Document<'a> { 21 + /// Strong reference to a Bluesky post. Useful to keep track of comments off-platform. 22 #[serde(skip_serializing_if = "std::option::Option::is_none")] 23 #[serde(borrow)] 24 + pub bsky_post_ref: std::option::Option< 25 + crate::com_atproto::repo::strong_ref::StrongRef<'a>, 26 + >, 27 + /// Open union used to define the record's content. Each entry must specify a $type and may be extended with other lexicons to support additional content formats. 28 #[serde(skip_serializing_if = "std::option::Option::is_none")] 29 #[serde(borrow)] 30 pub content: std::option::Option<jacquard_common::types::value::Data<'a>>, 31 + /// Image to used for thumbnail or cover image. Less than 1MB is size. 32 #[serde(skip_serializing_if = "std::option::Option::is_none")] 33 #[serde(borrow)] 34 pub cover_image: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, 35 + /// A brief description or excerpt from the document. 36 #[serde(skip_serializing_if = "std::option::Option::is_none")] 37 #[serde(borrow)] 38 pub description: std::option::Option<jacquard_common::CowStr<'a>>, 39 + /// Combine with site or publication url to construct a canonical URL to the document. Prepend with a leading slash. 40 #[serde(skip_serializing_if = "std::option::Option::is_none")] 41 #[serde(borrow)] 42 pub path: std::option::Option<jacquard_common::CowStr<'a>>, 43 + /// Timestamp of the documents publish time. 44 pub published_at: jacquard_common::types::string::Datetime, 45 + /// Points to a publication record (at://) or a publication url (https://) for loose documents. Avoid trailing slashes. 46 #[serde(borrow)] 47 pub site: jacquard_common::types::string::Uri<'a>, 48 + /// Array of strings used to tag or categorize the document. Avoid prepending tags with hashtags. 49 #[serde(skip_serializing_if = "std::option::Option::is_none")] 50 #[serde(borrow)] 51 pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, 52 + /// Plaintext representation of the documents contents. Should not contain markdown or other formatting. 53 #[serde(skip_serializing_if = "std::option::Option::is_none")] 54 #[serde(borrow)] 55 pub text_content: std::option::Option<jacquard_common::CowStr<'a>>, 56 + /// Title of the document. 57 #[serde(borrow)] 58 pub title: jacquard_common::CowStr<'a>, 59 + /// Timestamp of the documents last edit. 60 #[serde(skip_serializing_if = "std::option::Option::is_none")] 61 pub updated_at: std::option::Option<jacquard_common::types::string::Datetime>, 62 } 63 64 pub mod document_state { 65 66 + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 67 #[allow(unused)] 68 use ::core::marker::PhantomData; 69 mod sealed { ··· 71 } 72 /// State trait tracking which required fields have been set 73 pub trait State: sealed::Sealed { 74 + type PublishedAt; 75 type Title; 76 type Site; 77 } 78 /// Empty state - all required fields are unset 79 pub struct Empty(()); 80 impl sealed::Sealed for Empty {} 81 impl State for Empty { 82 + type PublishedAt = Unset; 83 type Title = Unset; 84 type Site = Unset; 85 + } 86 + ///State transition - sets the `published_at` field to Set 87 + pub struct SetPublishedAt<S: State = Empty>(PhantomData<fn() -> S>); 88 + impl<S: State> sealed::Sealed for SetPublishedAt<S> {} 89 + impl<S: State> State for SetPublishedAt<S> { 90 + type PublishedAt = Set<members::published_at>; 91 + type Title = S::Title; 92 + type Site = S::Site; 93 } 94 ///State transition - sets the `title` field to Set 95 pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>); 96 impl<S: State> sealed::Sealed for SetTitle<S> {} 97 impl<S: State> State for SetTitle<S> { 98 + type PublishedAt = S::PublishedAt; 99 type Title = Set<members::title>; 100 type Site = S::Site; 101 } 102 ///State transition - sets the `site` field to Set 103 pub struct SetSite<S: State = Empty>(PhantomData<fn() -> S>); 104 impl<S: State> sealed::Sealed for SetSite<S> {} 105 impl<S: State> State for SetSite<S> { 106 type PublishedAt = S::PublishedAt; 107 type Title = S::Title; 108 + type Site = Set<members::site>; 109 } 110 /// Marker types for field names 111 #[allow(non_camel_case_types)] 112 pub mod members { 113 + ///Marker type for the `published_at` field 114 + pub struct published_at(()); 115 ///Marker type for the `title` field 116 pub struct title(()); 117 ///Marker type for the `site` field 118 pub struct site(()); 119 } 120 } 121 ··· 151 DocumentBuilder { 152 _phantom_state: ::core::marker::PhantomData, 153 __unsafe_private_named: ( 154 + None, 155 + None, 156 + None, 157 + None, 158 + None, 159 + None, 160 + None, 161 + None, 162 + None, 163 + None, 164 + None, 165 ), 166 _phantom: ::core::marker::PhantomData, 167 } ··· 197 self 198 } 199 /// Set the `content` field to an Option value (optional) 200 + pub fn maybe_content( 201 + mut self, 202 + value: Option<jacquard_common::types::value::Data<'a>>, 203 + ) -> Self { 204 self.__unsafe_private_named.1 = value; 205 self 206 } ··· 227 228 impl<'a, S: document_state::State> DocumentBuilder<'a, S> { 229 /// Set the `description` field (optional) 230 + pub fn description( 231 + mut self, 232 + value: impl Into<Option<jacquard_common::CowStr<'a>>>, 233 + ) -> Self { 234 self.__unsafe_private_named.3 = value.into(); 235 self 236 } 237 /// Set the `description` field to an Option value (optional) 238 + pub fn maybe_description( 239 + mut self, 240 + value: Option<jacquard_common::CowStr<'a>>, 241 + ) -> Self { 242 self.__unsafe_private_named.3 = value; 243 self 244 } ··· 246 247 impl<'a, S: document_state::State> DocumentBuilder<'a, S> { 248 /// Set the `path` field (optional) 249 + pub fn path( 250 + mut self, 251 + value: impl Into<Option<jacquard_common::CowStr<'a>>>, 252 + ) -> Self { 253 self.__unsafe_private_named.4 = value.into(); 254 self 255 } ··· 300 301 impl<'a, S: document_state::State> DocumentBuilder<'a, S> { 302 /// Set the `tags` field (optional) 303 + pub fn tags( 304 + mut self, 305 + value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, 306 + ) -> Self { 307 self.__unsafe_private_named.7 = value.into(); 308 self 309 } 310 /// Set the `tags` field to an Option value (optional) 311 + pub fn maybe_tags( 312 + mut self, 313 + value: Option<Vec<jacquard_common::CowStr<'a>>>, 314 + ) -> Self { 315 self.__unsafe_private_named.7 = value; 316 self 317 } ··· 319 320 impl<'a, S: document_state::State> DocumentBuilder<'a, S> { 321 /// Set the `textContent` field (optional) 322 + pub fn text_content( 323 + mut self, 324 + value: impl Into<Option<jacquard_common::CowStr<'a>>>, 325 + ) -> Self { 326 self.__unsafe_private_named.8 = value.into(); 327 self 328 } 329 /// Set the `textContent` field to an Option value (optional) 330 + pub fn maybe_text_content( 331 + mut self, 332 + value: Option<jacquard_common::CowStr<'a>>, 333 + ) -> Self { 334 self.__unsafe_private_named.8 = value; 335 self 336 } ··· 377 impl<'a, S> DocumentBuilder<'a, S> 378 where 379 S: document_state::State, 380 + S::PublishedAt: document_state::IsSet, 381 S::Title: document_state::IsSet, 382 S::Site: document_state::IsSet, 383 { 384 /// Build the final struct 385 pub fn build(self) -> Document<'a> { ··· 438 439 /// Typed wrapper for GetRecord response with this collection's record type. 440 #[derive( 441 + serde::Serialize, 442 + serde::Deserialize, 443 + Debug, 444 + Clone, 445 + PartialEq, 446 + Eq, 447 + jacquard_derive::IntoStatic 448 )] 449 #[serde(rename_all = "camelCase")] 450 pub struct DocumentGetRecordOutput<'a> { ··· 499 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 500 if let Some(ref value) = self.description { 501 #[allow(unused_comparisons)] 502 + if <str>::len(value.as_ref()) > 30000usize { 503 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 504 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 505 + "description", 506 + ), 507 + max: 30000usize, 508 actual: <str>::len(value.as_ref()), 509 }); 510 } 511 } 512 if let Some(ref value) = self.description { 513 { 514 + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( 515 + value.as_ref(), 516 + true, 517 + ) 518 + .count(); 519 + if count > 3000usize { 520 + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 521 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 522 + "description", 523 + ), 524 + max: 3000usize, 525 + actual: count, 526 + }); 527 } 528 } 529 } 530 { 531 let value = &self.title; 532 #[allow(unused_comparisons)] 533 + if <str>::len(value.as_ref()) > 5000usize { 534 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 535 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 536 + "title", 537 + ), 538 + max: 5000usize, 539 actual: <str>::len(value.as_ref()), 540 }); 541 } ··· 543 { 544 let value = &self.title; 545 { 546 + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( 547 + value.as_ref(), 548 + true, 549 + ) 550 + .count(); 551 + if count > 500usize { 552 + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 553 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 554 + "title", 555 + ), 556 + max: 500usize, 557 + actual: count, 558 + }); 559 } 560 } 561 } ··· 563 } 564 } 565 566 + fn lexicon_doc_site_standard_document() -> ::jacquard_lexicon::lexicon::LexiconDoc< 567 + 'static, 568 + > { 569 ::jacquard_lexicon::lexicon::LexiconDoc { 570 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 571 id: ::jacquard_common::CowStr::new_static("site.standard.document"), ··· 576 map.insert( 577 ::jacquard_common::smol_str::SmolStr::new_static("main"), 578 ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { 579 + description: Some( 580 + ::jacquard_common::CowStr::new_static( 581 + "A document record representing a published article, blog post, or other content. Documents can belong to a publication or exist independently.", 582 + ), 583 + ), 584 key: Some(::jacquard_common::CowStr::new_static("tid")), 585 record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { 586 description: None, ··· 609 map.insert( 610 ::jacquard_common::smol_str::SmolStr::new_static("content"), 611 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { 612 + description: Some( 613 + ::jacquard_common::CowStr::new_static( 614 + "Open union used to define the record's content. Each entry must specify a $type and may be extended with other lexicons to support additional content formats.", 615 + ), 616 + ), 617 refs: vec![], 618 closed: Some(false), 619 }), ··· 633 "description", 634 ), 635 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 636 + description: Some( 637 + ::jacquard_common::CowStr::new_static( 638 + "A brief description or excerpt from the document.", 639 + ), 640 + ), 641 format: None, 642 default: None, 643 min_length: None, 644 + max_length: Some(30000usize), 645 min_graphemes: None, 646 + max_graphemes: Some(3000usize), 647 r#enum: None, 648 r#const: None, 649 known_values: None, ··· 654 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 655 description: Some( 656 ::jacquard_common::CowStr::new_static( 657 + "Combine with site or publication url to construct a canonical URL to the document. Prepend with a leading slash.", 658 ), 659 ), 660 format: None, ··· 673 "publishedAt", 674 ), 675 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 676 + description: Some( 677 + ::jacquard_common::CowStr::new_static( 678 + "Timestamp of the documents publish time.", 679 + ), 680 + ), 681 format: Some( 682 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 683 ), ··· 696 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 697 description: Some( 698 ::jacquard_common::CowStr::new_static( 699 + "Points to a publication record (at://) or a publication url (https://) for loose documents. Avoid trailing slashes.", 700 ), 701 ), 702 format: Some( ··· 715 map.insert( 716 ::jacquard_common::smol_str::SmolStr::new_static("tags"), 717 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 718 + description: Some( 719 + ::jacquard_common::CowStr::new_static( 720 + "Array of strings used to tag or categorize the document. Avoid prepending tags with hashtags.", 721 + ), 722 + ), 723 items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString { 724 description: None, 725 format: None, 726 default: None, 727 min_length: None, 728 + max_length: Some(1280usize), 729 min_graphemes: None, 730 + max_graphemes: Some(128usize), 731 r#enum: None, 732 r#const: None, 733 known_values: None, ··· 741 "textContent", 742 ), 743 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 744 + description: Some( 745 + ::jacquard_common::CowStr::new_static( 746 + "Plaintext representation of the documents contents. Should not contain markdown or other formatting.", 747 + ), 748 + ), 749 format: None, 750 default: None, 751 min_length: None, ··· 760 map.insert( 761 ::jacquard_common::smol_str::SmolStr::new_static("title"), 762 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 763 + description: Some( 764 + ::jacquard_common::CowStr::new_static( 765 + "Title of the document.", 766 + ), 767 + ), 768 format: None, 769 default: None, 770 min_length: None, 771 + max_length: Some(5000usize), 772 min_graphemes: None, 773 + max_graphemes: Some(500usize), 774 r#enum: None, 775 r#const: None, 776 known_values: None, ··· 781 "updatedAt", 782 ), 783 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 784 + description: Some( 785 + ::jacquard_common::CowStr::new_static( 786 + "Timestamp of the documents last edit.", 787 + ), 788 + ), 789 format: Some( 790 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 791 ), ··· 807 map 808 }, 809 } 810 + }
+1 -1
lexicons-example/src/site_standard/graph.rs
··· 3 // This file was automatically generated from Lexicon schemas. 4 // Any manual changes will be overwritten on the next regeneration. 5 6 - pub mod subscription;
··· 3 // This file was automatically generated from Lexicon schemas. 4 // Any manual changes will be overwritten on the next regeneration. 5 6 + pub mod subscription;
+22 -7
lexicons-example/src/site_standard/graph/subscription.rs
··· 8 /// Record declaring a subscription to a publication 9 #[jacquard_derive::lexicon] 10 #[derive( 11 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 12 )] 13 #[serde(rename_all = "camelCase")] 14 pub struct Subscription<'a> { ··· 19 20 pub mod subscription_state { 21 22 - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; 23 #[allow(unused)] 24 use ::core::marker::PhantomData; 25 mod sealed { ··· 52 /// Builder for constructing an instance of this type 53 pub struct SubscriptionBuilder<'a, S: subscription_state::State> { 54 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 55 - __unsafe_private_named: (::core::option::Option<jacquard_common::types::string::AtUri<'a>>,), 56 _phantom: ::core::marker::PhantomData<&'a ()>, 57 } 58 ··· 135 136 /// Typed wrapper for GetRecord response with this collection's record type. 137 #[derive( 138 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 139 )] 140 #[serde(rename_all = "camelCase")] 141 pub struct SubscriptionGetRecordOutput<'a> { ··· 192 } 193 } 194 195 - fn lexicon_doc_site_standard_graph_subscription() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> 196 - { 197 ::jacquard_lexicon::lexicon::LexiconDoc { 198 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 199 id: ::jacquard_common::CowStr::new_static("site.standard.graph.subscription"), ··· 252 map 253 }, 254 } 255 - }
··· 8 /// Record declaring a subscription to a publication 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 )] 19 #[serde(rename_all = "camelCase")] 20 pub struct Subscription<'a> { ··· 25 26 pub mod subscription_state { 27 28 + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 29 #[allow(unused)] 30 use ::core::marker::PhantomData; 31 mod sealed { ··· 58 /// Builder for constructing an instance of this type 59 pub struct SubscriptionBuilder<'a, S: subscription_state::State> { 60 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 61 + __unsafe_private_named: ( 62 + ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 63 + ), 64 _phantom: ::core::marker::PhantomData<&'a ()>, 65 } 66 ··· 143 144 /// Typed wrapper for GetRecord response with this collection's record type. 145 #[derive( 146 + serde::Serialize, 147 + serde::Deserialize, 148 + Debug, 149 + Clone, 150 + PartialEq, 151 + Eq, 152 + jacquard_derive::IntoStatic 153 )] 154 #[serde(rename_all = "camelCase")] 155 pub struct SubscriptionGetRecordOutput<'a> { ··· 206 } 207 } 208 209 + fn lexicon_doc_site_standard_graph_subscription() -> ::jacquard_lexicon::lexicon::LexiconDoc< 210 + 'static, 211 + > { 212 ::jacquard_lexicon::lexicon::LexiconDoc { 213 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 214 id: ::jacquard_common::CowStr::new_static("site.standard.graph.subscription"), ··· 267 map 268 }, 269 } 270 + }
+140 -84
lexicons-example/src/site_standard/publication.rs
··· 5 // This file was automatically generated from Lexicon schemas. 6 // Any manual changes will be overwritten on the next regeneration. 7 8 #[jacquard_derive::lexicon] 9 #[derive( 10 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 11 )] 12 #[serde(rename_all = "camelCase")] 13 pub struct Publication<'a> { 14 #[serde(skip_serializing_if = "std::option::Option::is_none")] 15 #[serde(borrow)] 16 pub basic_theme: std::option::Option<crate::site_standard::theme::basic::Basic<'a>>, 17 #[serde(skip_serializing_if = "std::option::Option::is_none")] 18 #[serde(borrow)] 19 pub description: std::option::Option<jacquard_common::CowStr<'a>>, 20 #[serde(skip_serializing_if = "std::option::Option::is_none")] 21 #[serde(borrow)] 22 pub icon: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, 23 #[serde(borrow)] 24 pub name: jacquard_common::CowStr<'a>, 25 #[serde(skip_serializing_if = "std::option::Option::is_none")] 26 #[serde(borrow)] 27 - pub preferences: std::option::Option<crate::site_standard::publication::Preferences<'a>>, 28 #[serde(borrow)] 29 pub url: jacquard_common::types::string::Uri<'a>, 30 } 31 32 pub mod publication_state { 33 34 - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; 35 #[allow(unused)] 36 use ::core::marker::PhantomData; 37 mod sealed { ··· 39 } 40 /// State trait tracking which required fields have been set 41 pub trait State: sealed::Sealed { 42 - type Name; 43 type Url; 44 } 45 /// Empty state - all required fields are unset 46 pub struct Empty(()); 47 impl sealed::Sealed for Empty {} 48 impl State for Empty { 49 - type Name = Unset; 50 type Url = Unset; 51 - } 52 - ///State transition - sets the `name` field to Set 53 - pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); 54 - impl<S: State> sealed::Sealed for SetName<S> {} 55 - impl<S: State> State for SetName<S> { 56 - type Name = Set<members::name>; 57 - type Url = S::Url; 58 } 59 ///State transition - sets the `url` field to Set 60 pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); 61 impl<S: State> sealed::Sealed for SetUrl<S> {} 62 impl<S: State> State for SetUrl<S> { 63 type Name = S::Name; 64 - type Url = Set<members::url>; 65 } 66 /// Marker types for field names 67 #[allow(non_camel_case_types)] 68 pub mod members { 69 ///Marker type for the `name` field 70 pub struct name(()); 71 - ///Marker type for the `url` field 72 - pub struct url(()); 73 } 74 } 75 ··· 126 127 impl<'a, S: publication_state::State> PublicationBuilder<'a, S> { 128 /// Set the `description` field (optional) 129 - pub fn description(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self { 130 self.__unsafe_private_named.1 = value.into(); 131 self 132 } 133 /// Set the `description` field to an Option value (optional) 134 - pub fn maybe_description(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 135 self.__unsafe_private_named.1 = value; 136 self 137 } ··· 147 self 148 } 149 /// Set the `icon` field to an Option value (optional) 150 - pub fn maybe_icon(mut self, value: Option<jacquard_common::types::blob::BlobRef<'a>>) -> Self { 151 self.__unsafe_private_named.2 = value; 152 self 153 } ··· 213 impl<'a, S> PublicationBuilder<'a, S> 214 where 215 S: publication_state::State, 216 - S::Name: publication_state::IsSet, 217 S::Url: publication_state::IsSet, 218 { 219 /// Build the final struct 220 pub fn build(self) -> Publication<'a> { ··· 263 264 /// Typed wrapper for GetRecord response with this collection's record type. 265 #[derive( 266 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 267 )] 268 #[serde(rename_all = "camelCase")] 269 pub struct PublicationGetRecordOutput<'a> { ··· 318 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 319 if let Some(ref value) = self.description { 320 #[allow(unused_comparisons)] 321 - if <str>::len(value.as_ref()) > 3000usize { 322 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 323 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("description"), 324 - max: 3000usize, 325 actual: <str>::len(value.as_ref()), 326 }); 327 } 328 } 329 if let Some(ref value) = self.description { 330 { 331 - let count = 332 - ::unicode_segmentation::UnicodeSegmentation::graphemes(value.as_ref(), true) 333 - .count(); 334 - if count > 300usize { 335 - return Err( 336 - ::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 337 - path: ::jacquard_lexicon::validation::ValidationPath::from_field( 338 - "description", 339 - ), 340 - max: 300usize, 341 - actual: count, 342 - }, 343 - ); 344 } 345 } 346 } 347 { 348 let value = &self.name; 349 #[allow(unused_comparisons)] 350 - if <str>::len(value.as_ref()) > 1280usize { 351 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 352 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("name"), 353 - max: 1280usize, 354 actual: <str>::len(value.as_ref()), 355 }); 356 } ··· 358 { 359 let value = &self.name; 360 { 361 - let count = 362 - ::unicode_segmentation::UnicodeSegmentation::graphemes(value.as_ref(), true) 363 - .count(); 364 - if count > 128usize { 365 - return Err( 366 - ::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 367 - path: ::jacquard_lexicon::validation::ValidationPath::from_field( 368 - "name", 369 - ), 370 - max: 128usize, 371 - actual: count, 372 - }, 373 - ); 374 } 375 } 376 } ··· 378 } 379 } 380 381 - fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 382 ::jacquard_lexicon::lexicon::LexiconDoc { 383 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 384 id: ::jacquard_common::CowStr::new_static("site.standard.publication"), ··· 389 map.insert( 390 ::jacquard_common::smol_str::SmolStr::new_static("main"), 391 ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { 392 - description: None, 393 key: Some(::jacquard_common::CowStr::new_static("tid")), 394 record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { 395 description: None, ··· 419 "description", 420 ), 421 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 422 - description: None, 423 format: None, 424 default: None, 425 min_length: None, 426 - max_length: Some(3000usize), 427 min_graphemes: None, 428 - max_graphemes: Some(300usize), 429 r#enum: None, 430 r#const: None, 431 known_values: None, ··· 442 map.insert( 443 ::jacquard_common::smol_str::SmolStr::new_static("name"), 444 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 445 - description: None, 446 format: None, 447 default: None, 448 min_length: None, 449 - max_length: Some(1280usize), 450 min_graphemes: None, 451 - max_graphemes: Some(128usize), 452 r#enum: None, 453 r#const: None, 454 known_values: None, ··· 466 map.insert( 467 ::jacquard_common::smol_str::SmolStr::new_static("url"), 468 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 469 - description: None, 470 format: Some( 471 ::jacquard_lexicon::lexicon::LexStringFormat::Uri, 472 ), ··· 487 ); 488 map.insert( 489 ::jacquard_common::smol_str::SmolStr::new_static("preferences"), 490 - ::jacquard_lexicon::lexicon::LexUserType::Object( 491 - ::jacquard_lexicon::lexicon::LexObject { 492 - description: None, 493 - required: None, 494 - nullable: None, 495 - properties: { 496 - #[allow(unused_mut)] 497 - let mut map = ::std::collections::BTreeMap::new(); 498 - map.insert( 499 - ::jacquard_common::smol_str::SmolStr::new_static("showInDiscover"), 500 - ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean( 501 - ::jacquard_lexicon::lexicon::LexBoolean { 502 - description: None, 503 - default: None, 504 - r#const: None, 505 - }, 506 - ), 507 - ); 508 - map 509 - }, 510 }, 511 - ), 512 ); 513 map 514 }, 515 } 516 } 517 518 #[jacquard_derive::lexicon] 519 #[derive( 520 serde::Serialize, ··· 524 PartialEq, 525 Eq, 526 jacquard_derive::IntoStatic, 527 - Default, 528 )] 529 #[serde(rename_all = "camelCase")] 530 pub struct Preferences<'a> { 531 #[serde(skip_serializing_if = "std::option::Option::is_none")] 532 pub show_in_discover: std::option::Option<bool>, 533 } ··· 547 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 548 Ok(()) 549 } 550 - }
··· 5 // This file was automatically generated from Lexicon schemas. 6 // Any manual changes will be overwritten on the next regeneration. 7 8 + /// A publication record representing a blog, website, or content platform. Publications serve as containers for documents and define the overall branding and settings. 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 )] 19 #[serde(rename_all = "camelCase")] 20 pub struct Publication<'a> { 21 + /// Simplified publication theme for tools and apps to utilize when displaying content. 22 #[serde(skip_serializing_if = "std::option::Option::is_none")] 23 #[serde(borrow)] 24 pub basic_theme: std::option::Option<crate::site_standard::theme::basic::Basic<'a>>, 25 + /// Brief description of the publication. 26 #[serde(skip_serializing_if = "std::option::Option::is_none")] 27 #[serde(borrow)] 28 pub description: std::option::Option<jacquard_common::CowStr<'a>>, 29 + /// Square image to identify the publication. Should be at least 256x256. 30 #[serde(skip_serializing_if = "std::option::Option::is_none")] 31 #[serde(borrow)] 32 pub icon: std::option::Option<jacquard_common::types::blob::BlobRef<'a>>, 33 + /// Name of the publication. 34 #[serde(borrow)] 35 pub name: jacquard_common::CowStr<'a>, 36 + /// Object containing platform specific preferences (with a few shared properties). 37 #[serde(skip_serializing_if = "std::option::Option::is_none")] 38 #[serde(borrow)] 39 + pub preferences: std::option::Option< 40 + crate::site_standard::publication::Preferences<'a>, 41 + >, 42 + /// Base publication url (ex: https://standard.site). The canonical document URL is formed by combining this value with the document path. 43 #[serde(borrow)] 44 pub url: jacquard_common::types::string::Uri<'a>, 45 } 46 47 pub mod publication_state { 48 49 + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 50 #[allow(unused)] 51 use ::core::marker::PhantomData; 52 mod sealed { ··· 54 } 55 /// State trait tracking which required fields have been set 56 pub trait State: sealed::Sealed { 57 type Url; 58 + type Name; 59 } 60 /// Empty state - all required fields are unset 61 pub struct Empty(()); 62 impl sealed::Sealed for Empty {} 63 impl State for Empty { 64 type Url = Unset; 65 + type Name = Unset; 66 } 67 ///State transition - sets the `url` field to Set 68 pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>); 69 impl<S: State> sealed::Sealed for SetUrl<S> {} 70 impl<S: State> State for SetUrl<S> { 71 + type Url = Set<members::url>; 72 type Name = S::Name; 73 + } 74 + ///State transition - sets the `name` field to Set 75 + pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); 76 + impl<S: State> sealed::Sealed for SetName<S> {} 77 + impl<S: State> State for SetName<S> { 78 + type Url = S::Url; 79 + type Name = Set<members::name>; 80 } 81 /// Marker types for field names 82 #[allow(non_camel_case_types)] 83 pub mod members { 84 + ///Marker type for the `url` field 85 + pub struct url(()); 86 ///Marker type for the `name` field 87 pub struct name(()); 88 } 89 } 90 ··· 141 142 impl<'a, S: publication_state::State> PublicationBuilder<'a, S> { 143 /// Set the `description` field (optional) 144 + pub fn description( 145 + mut self, 146 + value: impl Into<Option<jacquard_common::CowStr<'a>>>, 147 + ) -> Self { 148 self.__unsafe_private_named.1 = value.into(); 149 self 150 } 151 /// Set the `description` field to an Option value (optional) 152 + pub fn maybe_description( 153 + mut self, 154 + value: Option<jacquard_common::CowStr<'a>>, 155 + ) -> Self { 156 self.__unsafe_private_named.1 = value; 157 self 158 } ··· 168 self 169 } 170 /// Set the `icon` field to an Option value (optional) 171 + pub fn maybe_icon( 172 + mut self, 173 + value: Option<jacquard_common::types::blob::BlobRef<'a>>, 174 + ) -> Self { 175 self.__unsafe_private_named.2 = value; 176 self 177 } ··· 237 impl<'a, S> PublicationBuilder<'a, S> 238 where 239 S: publication_state::State, 240 S::Url: publication_state::IsSet, 241 + S::Name: publication_state::IsSet, 242 { 243 /// Build the final struct 244 pub fn build(self) -> Publication<'a> { ··· 287 288 /// Typed wrapper for GetRecord response with this collection's record type. 289 #[derive( 290 + serde::Serialize, 291 + serde::Deserialize, 292 + Debug, 293 + Clone, 294 + PartialEq, 295 + Eq, 296 + jacquard_derive::IntoStatic 297 )] 298 #[serde(rename_all = "camelCase")] 299 pub struct PublicationGetRecordOutput<'a> { ··· 348 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 349 if let Some(ref value) = self.description { 350 #[allow(unused_comparisons)] 351 + if <str>::len(value.as_ref()) > 30000usize { 352 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 353 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 354 + "description", 355 + ), 356 + max: 30000usize, 357 actual: <str>::len(value.as_ref()), 358 }); 359 } 360 } 361 if let Some(ref value) = self.description { 362 { 363 + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( 364 + value.as_ref(), 365 + true, 366 + ) 367 + .count(); 368 + if count > 3000usize { 369 + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 370 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 371 + "description", 372 + ), 373 + max: 3000usize, 374 + actual: count, 375 + }); 376 } 377 } 378 } 379 { 380 let value = &self.name; 381 #[allow(unused_comparisons)] 382 + if <str>::len(value.as_ref()) > 5000usize { 383 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 384 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 385 + "name", 386 + ), 387 + max: 5000usize, 388 actual: <str>::len(value.as_ref()), 389 }); 390 } ··· 392 { 393 let value = &self.name; 394 { 395 + let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( 396 + value.as_ref(), 397 + true, 398 + ) 399 + .count(); 400 + if count > 500usize { 401 + return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 402 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 403 + "name", 404 + ), 405 + max: 500usize, 406 + actual: count, 407 + }); 408 } 409 } 410 } ··· 412 } 413 } 414 415 + fn lexicon_doc_site_standard_publication() -> ::jacquard_lexicon::lexicon::LexiconDoc< 416 + 'static, 417 + > { 418 ::jacquard_lexicon::lexicon::LexiconDoc { 419 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 420 id: ::jacquard_common::CowStr::new_static("site.standard.publication"), ··· 425 map.insert( 426 ::jacquard_common::smol_str::SmolStr::new_static("main"), 427 ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { 428 + description: Some( 429 + ::jacquard_common::CowStr::new_static( 430 + "A publication record representing a blog, website, or content platform. Publications serve as containers for documents and define the overall branding and settings.", 431 + ), 432 + ), 433 key: Some(::jacquard_common::CowStr::new_static("tid")), 434 record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { 435 description: None, ··· 459 "description", 460 ), 461 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 462 + description: Some( 463 + ::jacquard_common::CowStr::new_static( 464 + "Brief description of the publication.", 465 + ), 466 + ), 467 format: None, 468 default: None, 469 min_length: None, 470 + max_length: Some(30000usize), 471 min_graphemes: None, 472 + max_graphemes: Some(3000usize), 473 r#enum: None, 474 r#const: None, 475 known_values: None, ··· 486 map.insert( 487 ::jacquard_common::smol_str::SmolStr::new_static("name"), 488 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 489 + description: Some( 490 + ::jacquard_common::CowStr::new_static( 491 + "Name of the publication.", 492 + ), 493 + ), 494 format: None, 495 default: None, 496 min_length: None, 497 + max_length: Some(5000usize), 498 min_graphemes: None, 499 + max_graphemes: Some(500usize), 500 r#enum: None, 501 r#const: None, 502 known_values: None, ··· 514 map.insert( 515 ::jacquard_common::smol_str::SmolStr::new_static("url"), 516 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 517 + description: Some( 518 + ::jacquard_common::CowStr::new_static( 519 + "Base publication url (ex: https://standard.site). The canonical document URL is formed by combining this value with the document path.", 520 + ), 521 + ), 522 format: Some( 523 ::jacquard_lexicon::lexicon::LexStringFormat::Uri, 524 ), ··· 539 ); 540 map.insert( 541 ::jacquard_common::smol_str::SmolStr::new_static("preferences"), 542 + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 543 + description: Some( 544 + ::jacquard_common::CowStr::new_static( 545 + "Platform-specific preferences for the publication, including discovery and visibility settings.", 546 + ), 547 + ), 548 + required: None, 549 + nullable: None, 550 + properties: { 551 + #[allow(unused_mut)] 552 + let mut map = ::std::collections::BTreeMap::new(); 553 + map.insert( 554 + ::jacquard_common::smol_str::SmolStr::new_static( 555 + "showInDiscover", 556 + ), 557 + ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 558 + description: None, 559 + default: None, 560 + r#const: None, 561 + }), 562 + ); 563 + map 564 }, 565 + }), 566 ); 567 map 568 }, 569 } 570 } 571 572 + /// Platform-specific preferences for the publication, including discovery and visibility settings. 573 #[jacquard_derive::lexicon] 574 #[derive( 575 serde::Serialize, ··· 579 PartialEq, 580 Eq, 581 jacquard_derive::IntoStatic, 582 + Default 583 )] 584 #[serde(rename_all = "camelCase")] 585 pub struct Preferences<'a> { 586 + /// Boolean which decides whether the publication should appear in discovery feeds. 587 #[serde(skip_serializing_if = "std::option::Option::is_none")] 588 pub show_in_discover: std::option::Option<bool>, 589 } ··· 603 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 604 Ok(()) 605 } 606 + }
+1 -1
lexicons-example/src/site_standard/theme.rs
··· 4 // Any manual changes will be overwritten on the next regeneration. 5 6 pub mod basic; 7 - pub mod color;
··· 4 // Any manual changes will be overwritten on the next regeneration. 5 6 pub mod basic; 7 + pub mod color;
+29 -21
lexicons-example/src/site_standard/theme/basic.rs
··· 8 /// A simplified theme definition for publications, providing basic color customization for content display across different platforms and applications. 9 #[jacquard_derive::lexicon] 10 #[derive( 11 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 12 )] 13 #[serde(rename_all = "camelCase")] 14 pub struct Basic<'a> { ··· 28 29 pub mod basic_state { 30 31 - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; 32 #[allow(unused)] 33 use ::core::marker::PhantomData; 34 mod sealed { ··· 36 } 37 /// State trait tracking which required fields have been set 38 pub trait State: sealed::Sealed { 39 - type Background; 40 type AccentForeground; 41 type Accent; 42 type Foreground; 43 } 44 /// Empty state - all required fields are unset 45 pub struct Empty(()); 46 impl sealed::Sealed for Empty {} 47 impl State for Empty { 48 - type Background = Unset; 49 type AccentForeground = Unset; 50 type Accent = Unset; 51 type Foreground = Unset; 52 } 53 - ///State transition - sets the `background` field to Set 54 - pub struct SetBackground<S: State = Empty>(PhantomData<fn() -> S>); 55 - impl<S: State> sealed::Sealed for SetBackground<S> {} 56 - impl<S: State> State for SetBackground<S> { 57 - type Background = Set<members::background>; 58 - type AccentForeground = S::AccentForeground; 59 - type Accent = S::Accent; 60 - type Foreground = S::Foreground; 61 - } 62 ///State transition - sets the `accent_foreground` field to Set 63 pub struct SetAccentForeground<S: State = Empty>(PhantomData<fn() -> S>); 64 impl<S: State> sealed::Sealed for SetAccentForeground<S> {} 65 impl<S: State> State for SetAccentForeground<S> { 66 - type Background = S::Background; 67 type AccentForeground = Set<members::accent_foreground>; 68 type Accent = S::Accent; 69 type Foreground = S::Foreground; 70 } 71 ///State transition - sets the `accent` field to Set 72 pub struct SetAccent<S: State = Empty>(PhantomData<fn() -> S>); 73 impl<S: State> sealed::Sealed for SetAccent<S> {} 74 impl<S: State> State for SetAccent<S> { 75 type Background = S::Background; 76 type AccentForeground = S::AccentForeground; 77 - type Accent = Set<members::accent>; 78 type Foreground = S::Foreground; 79 } 80 ///State transition - sets the `foreground` field to Set 81 pub struct SetForeground<S: State = Empty>(PhantomData<fn() -> S>); 82 impl<S: State> sealed::Sealed for SetForeground<S> {} 83 impl<S: State> State for SetForeground<S> { 84 - type Background = S::Background; 85 type AccentForeground = S::AccentForeground; 86 type Accent = S::Accent; 87 type Foreground = Set<members::foreground>; 88 } 89 /// Marker types for field names 90 #[allow(non_camel_case_types)] 91 pub mod members { 92 - ///Marker type for the `background` field 93 - pub struct background(()); 94 ///Marker type for the `accent_foreground` field 95 pub struct accent_foreground(()); 96 ///Marker type for the `accent` field 97 pub struct accent(()); 98 ///Marker type for the `foreground` field 99 pub struct foreground(()); 100 } ··· 209 impl<'a, S> BasicBuilder<'a, S> 210 where 211 S: basic_state::State, 212 - S::Background: basic_state::IsSet, 213 S::AccentForeground: basic_state::IsSet, 214 S::Accent: basic_state::IsSet, 215 S::Foreground: basic_state::IsSet, 216 { 217 /// Build the final struct ··· 242 } 243 } 244 245 - fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 246 ::jacquard_lexicon::lexicon::LexiconDoc { 247 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 248 id: ::jacquard_common::CowStr::new_static("site.standard.theme.basic"), ··· 356 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 357 Ok(()) 358 } 359 - }
··· 8 /// A simplified theme definition for publications, providing basic color customization for content display across different platforms and applications. 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 )] 19 #[serde(rename_all = "camelCase")] 20 pub struct Basic<'a> { ··· 34 35 pub mod basic_state { 36 37 + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 38 #[allow(unused)] 39 use ::core::marker::PhantomData; 40 mod sealed { ··· 42 } 43 /// State trait tracking which required fields have been set 44 pub trait State: sealed::Sealed { 45 type AccentForeground; 46 type Accent; 47 + type Background; 48 type Foreground; 49 } 50 /// Empty state - all required fields are unset 51 pub struct Empty(()); 52 impl sealed::Sealed for Empty {} 53 impl State for Empty { 54 type AccentForeground = Unset; 55 type Accent = Unset; 56 + type Background = Unset; 57 type Foreground = Unset; 58 } 59 ///State transition - sets the `accent_foreground` field to Set 60 pub struct SetAccentForeground<S: State = Empty>(PhantomData<fn() -> S>); 61 impl<S: State> sealed::Sealed for SetAccentForeground<S> {} 62 impl<S: State> State for SetAccentForeground<S> { 63 type AccentForeground = Set<members::accent_foreground>; 64 type Accent = S::Accent; 65 + type Background = S::Background; 66 type Foreground = S::Foreground; 67 } 68 ///State transition - sets the `accent` field to Set 69 pub struct SetAccent<S: State = Empty>(PhantomData<fn() -> S>); 70 impl<S: State> sealed::Sealed for SetAccent<S> {} 71 impl<S: State> State for SetAccent<S> { 72 + type AccentForeground = S::AccentForeground; 73 + type Accent = Set<members::accent>; 74 type Background = S::Background; 75 + type Foreground = S::Foreground; 76 + } 77 + ///State transition - sets the `background` field to Set 78 + pub struct SetBackground<S: State = Empty>(PhantomData<fn() -> S>); 79 + impl<S: State> sealed::Sealed for SetBackground<S> {} 80 + impl<S: State> State for SetBackground<S> { 81 type AccentForeground = S::AccentForeground; 82 + type Accent = S::Accent; 83 + type Background = Set<members::background>; 84 type Foreground = S::Foreground; 85 } 86 ///State transition - sets the `foreground` field to Set 87 pub struct SetForeground<S: State = Empty>(PhantomData<fn() -> S>); 88 impl<S: State> sealed::Sealed for SetForeground<S> {} 89 impl<S: State> State for SetForeground<S> { 90 type AccentForeground = S::AccentForeground; 91 type Accent = S::Accent; 92 + type Background = S::Background; 93 type Foreground = Set<members::foreground>; 94 } 95 /// Marker types for field names 96 #[allow(non_camel_case_types)] 97 pub mod members { 98 ///Marker type for the `accent_foreground` field 99 pub struct accent_foreground(()); 100 ///Marker type for the `accent` field 101 pub struct accent(()); 102 + ///Marker type for the `background` field 103 + pub struct background(()); 104 ///Marker type for the `foreground` field 105 pub struct foreground(()); 106 } ··· 215 impl<'a, S> BasicBuilder<'a, S> 216 where 217 S: basic_state::State, 218 S::AccentForeground: basic_state::IsSet, 219 S::Accent: basic_state::IsSet, 220 + S::Background: basic_state::IsSet, 221 S::Foreground: basic_state::IsSet, 222 { 223 /// Build the final struct ··· 248 } 249 } 250 251 + fn lexicon_doc_site_standard_theme_basic() -> ::jacquard_lexicon::lexicon::LexiconDoc< 252 + 'static, 253 + > { 254 ::jacquard_lexicon::lexicon::LexiconDoc { 255 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 256 id: ::jacquard_common::CowStr::new_static("site.standard.theme.basic"), ··· 364 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 365 Ok(()) 366 } 367 + }
+195 -167
lexicons-example/src/site_standard/theme/color.rs
··· 7 8 #[jacquard_derive::lexicon] 9 #[derive( 10 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 11 )] 12 #[serde(rename_all = "camelCase")] 13 pub struct Rgb<'a> { ··· 18 19 pub mod rgb_state { 20 21 - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; 22 #[allow(unused)] 23 use ::core::marker::PhantomData; 24 mod sealed { ··· 26 } 27 /// State trait tracking which required fields have been set 28 pub trait State: sealed::Sealed { 29 type B; 30 type R; 31 - type G; 32 } 33 /// Empty state - all required fields are unset 34 pub struct Empty(()); 35 impl sealed::Sealed for Empty {} 36 impl State for Empty { 37 type B = Unset; 38 type R = Unset; 39 - type G = Unset; 40 } 41 ///State transition - sets the `b` field to Set 42 pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); 43 impl<S: State> sealed::Sealed for SetB<S> {} 44 impl<S: State> State for SetB<S> { 45 type B = Set<members::b>; 46 type R = S::R; 47 - type G = S::G; 48 } 49 ///State transition - sets the `r` field to Set 50 pub struct SetR<S: State = Empty>(PhantomData<fn() -> S>); 51 impl<S: State> sealed::Sealed for SetR<S> {} 52 impl<S: State> State for SetR<S> { 53 type B = S::B; 54 type R = Set<members::r>; 55 - type G = S::G; 56 - } 57 - ///State transition - sets the `g` field to Set 58 - pub struct SetG<S: State = Empty>(PhantomData<fn() -> S>); 59 - impl<S: State> sealed::Sealed for SetG<S> {} 60 - impl<S: State> State for SetG<S> { 61 - type B = S::B; 62 - type R = S::R; 63 - type G = Set<members::g>; 64 } 65 /// Marker types for field names 66 #[allow(non_camel_case_types)] 67 pub mod members { 68 ///Marker type for the `b` field 69 pub struct b(()); 70 ///Marker type for the `r` field 71 pub struct r(()); 72 - ///Marker type for the `g` field 73 - pub struct g(()); 74 } 75 } 76 ··· 154 impl<'a, S> RgbBuilder<'a, S> 155 where 156 S: rgb_state::State, 157 S::B: rgb_state::IsSet, 158 S::R: rgb_state::IsSet, 159 - S::G: rgb_state::IsSet, 160 { 161 /// Build the final struct 162 pub fn build(self) -> Rgb<'a> { ··· 184 } 185 } 186 187 - fn lexicon_doc_site_standard_theme_color() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 188 ::jacquard_lexicon::lexicon::LexiconDoc { 189 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 190 id: ::jacquard_common::CowStr::new_static("site.standard.theme.color"), ··· 194 let mut map = ::std::collections::BTreeMap::new(); 195 map.insert( 196 ::jacquard_common::smol_str::SmolStr::new_static("rgb"), 197 - ::jacquard_lexicon::lexicon::LexUserType::Object( 198 - ::jacquard_lexicon::lexicon::LexObject { 199 - description: None, 200 - required: Some(vec![ 201 ::jacquard_common::smol_str::SmolStr::new_static("r"), 202 ::jacquard_common::smol_str::SmolStr::new_static("g"), 203 ::jacquard_common::smol_str::SmolStr::new_static("b"), 204 - ]), 205 - nullable: None, 206 - properties: { 207 - #[allow(unused_mut)] 208 - let mut map = ::std::collections::BTreeMap::new(); 209 - map.insert( 210 - ::jacquard_common::smol_str::SmolStr::new_static("b"), 211 - ::jacquard_lexicon::lexicon::LexObjectProperty::Integer( 212 - ::jacquard_lexicon::lexicon::LexInteger { 213 - description: None, 214 - default: None, 215 - minimum: Some(0i64), 216 - maximum: Some(255i64), 217 - r#enum: None, 218 - r#const: None, 219 - }, 220 - ), 221 - ); 222 - map.insert( 223 - ::jacquard_common::smol_str::SmolStr::new_static("g"), 224 - ::jacquard_lexicon::lexicon::LexObjectProperty::Integer( 225 - ::jacquard_lexicon::lexicon::LexInteger { 226 - description: None, 227 - default: None, 228 - minimum: Some(0i64), 229 - maximum: Some(255i64), 230 - r#enum: None, 231 - r#const: None, 232 - }, 233 - ), 234 - ); 235 - map.insert( 236 - ::jacquard_common::smol_str::SmolStr::new_static("r"), 237 - ::jacquard_lexicon::lexicon::LexObjectProperty::Integer( 238 - ::jacquard_lexicon::lexicon::LexInteger { 239 - description: None, 240 - default: None, 241 - minimum: Some(0i64), 242 - maximum: Some(255i64), 243 - r#enum: None, 244 - r#const: None, 245 - }, 246 - ), 247 - ); 248 - map 249 - }, 250 }, 251 - ), 252 ); 253 map.insert( 254 ::jacquard_common::smol_str::SmolStr::new_static("rgba"), 255 - ::jacquard_lexicon::lexicon::LexUserType::Object( 256 - ::jacquard_lexicon::lexicon::LexObject { 257 - description: None, 258 - required: Some(vec![ 259 ::jacquard_common::smol_str::SmolStr::new_static("r"), 260 ::jacquard_common::smol_str::SmolStr::new_static("g"), 261 ::jacquard_common::smol_str::SmolStr::new_static("b"), 262 ::jacquard_common::smol_str::SmolStr::new_static("a"), 263 - ]), 264 - nullable: None, 265 - properties: { 266 - #[allow(unused_mut)] 267 - let mut map = ::std::collections::BTreeMap::new(); 268 - map.insert( 269 - ::jacquard_common::smol_str::SmolStr::new_static("a"), 270 - ::jacquard_lexicon::lexicon::LexObjectProperty::Integer( 271 - ::jacquard_lexicon::lexicon::LexInteger { 272 - description: None, 273 - default: None, 274 - minimum: Some(0i64), 275 - maximum: Some(100i64), 276 - r#enum: None, 277 - r#const: None, 278 - }, 279 - ), 280 - ); 281 - map.insert( 282 - ::jacquard_common::smol_str::SmolStr::new_static("b"), 283 - ::jacquard_lexicon::lexicon::LexObjectProperty::Integer( 284 - ::jacquard_lexicon::lexicon::LexInteger { 285 - description: None, 286 - default: None, 287 - minimum: Some(0i64), 288 - maximum: Some(255i64), 289 - r#enum: None, 290 - r#const: None, 291 - }, 292 - ), 293 - ); 294 - map.insert( 295 - ::jacquard_common::smol_str::SmolStr::new_static("g"), 296 - ::jacquard_lexicon::lexicon::LexObjectProperty::Integer( 297 - ::jacquard_lexicon::lexicon::LexInteger { 298 - description: None, 299 - default: None, 300 - minimum: Some(0i64), 301 - maximum: Some(255i64), 302 - r#enum: None, 303 - r#const: None, 304 - }, 305 - ), 306 - ); 307 - map.insert( 308 - ::jacquard_common::smol_str::SmolStr::new_static("r"), 309 - ::jacquard_lexicon::lexicon::LexObjectProperty::Integer( 310 - ::jacquard_lexicon::lexicon::LexInteger { 311 - description: None, 312 - default: None, 313 - minimum: Some(0i64), 314 - maximum: Some(255i64), 315 - r#enum: None, 316 - r#const: None, 317 - }, 318 - ), 319 - ); 320 - map 321 - }, 322 }, 323 - ), 324 ); 325 map 326 }, ··· 344 let value = &self.b; 345 if *value > 255i64 { 346 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 347 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("b"), 348 max: 255i64, 349 actual: *value, 350 }); ··· 354 let value = &self.b; 355 if *value < 0i64 { 356 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 357 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("b"), 358 min: 0i64, 359 actual: *value, 360 }); ··· 364 let value = &self.g; 365 if *value > 255i64 { 366 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 367 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("g"), 368 max: 255i64, 369 actual: *value, 370 }); ··· 374 let value = &self.g; 375 if *value < 0i64 { 376 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 377 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("g"), 378 min: 0i64, 379 actual: *value, 380 }); ··· 384 let value = &self.r; 385 if *value > 255i64 { 386 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 387 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("r"), 388 max: 255i64, 389 actual: *value, 390 }); ··· 394 let value = &self.r; 395 if *value < 0i64 { 396 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 397 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("r"), 398 min: 0i64, 399 actual: *value, 400 }); ··· 406 407 #[jacquard_derive::lexicon] 408 #[derive( 409 - serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, 410 )] 411 #[serde(rename_all = "camelCase")] 412 pub struct Rgba<'a> { ··· 418 419 pub mod rgba_state { 420 421 - pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; 422 #[allow(unused)] 423 use ::core::marker::PhantomData; 424 mod sealed { ··· 427 /// State trait tracking which required fields have been set 428 pub trait State: sealed::Sealed { 429 type A; 430 type R; 431 type B; 432 - type G; 433 } 434 /// Empty state - all required fields are unset 435 pub struct Empty(()); 436 impl sealed::Sealed for Empty {} 437 impl State for Empty { 438 type A = Unset; 439 type R = Unset; 440 type B = Unset; 441 - type G = Unset; 442 } 443 ///State transition - sets the `a` field to Set 444 pub struct SetA<S: State = Empty>(PhantomData<fn() -> S>); 445 impl<S: State> sealed::Sealed for SetA<S> {} 446 impl<S: State> State for SetA<S> { 447 type A = Set<members::a>; 448 type R = S::R; 449 type B = S::B; 450 - type G = S::G; 451 } 452 ///State transition - sets the `r` field to Set 453 pub struct SetR<S: State = Empty>(PhantomData<fn() -> S>); 454 impl<S: State> sealed::Sealed for SetR<S> {} 455 impl<S: State> State for SetR<S> { 456 type A = S::A; 457 type R = Set<members::r>; 458 type B = S::B; 459 - type G = S::G; 460 } 461 ///State transition - sets the `b` field to Set 462 pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); 463 impl<S: State> sealed::Sealed for SetB<S> {} 464 impl<S: State> State for SetB<S> { 465 type A = S::A; 466 - type R = S::R; 467 - type B = Set<members::b>; 468 type G = S::G; 469 - } 470 - ///State transition - sets the `g` field to Set 471 - pub struct SetG<S: State = Empty>(PhantomData<fn() -> S>); 472 - impl<S: State> sealed::Sealed for SetG<S> {} 473 - impl<S: State> State for SetG<S> { 474 - type A = S::A; 475 type R = S::R; 476 - type B = S::B; 477 - type G = Set<members::g>; 478 } 479 /// Marker types for field names 480 #[allow(non_camel_case_types)] 481 pub mod members { 482 ///Marker type for the `a` field 483 pub struct a(()); 484 ///Marker type for the `r` field 485 pub struct r(()); 486 ///Marker type for the `b` field 487 pub struct b(()); 488 - ///Marker type for the `g` field 489 - pub struct g(()); 490 } 491 } 492 ··· 588 where 589 S: rgba_state::State, 590 S::A: rgba_state::IsSet, 591 S::R: rgba_state::IsSet, 592 S::B: rgba_state::IsSet, 593 - S::G: rgba_state::IsSet, 594 { 595 /// Build the final struct 596 pub fn build(self) -> Rgba<'a> { ··· 637 let value = &self.a; 638 if *value > 100i64 { 639 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 640 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("a"), 641 max: 100i64, 642 actual: *value, 643 }); ··· 647 let value = &self.a; 648 if *value < 0i64 { 649 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 650 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("a"), 651 min: 0i64, 652 actual: *value, 653 }); ··· 657 let value = &self.b; 658 if *value > 255i64 { 659 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 660 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("b"), 661 max: 255i64, 662 actual: *value, 663 }); ··· 667 let value = &self.b; 668 if *value < 0i64 { 669 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 670 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("b"), 671 min: 0i64, 672 actual: *value, 673 }); ··· 677 let value = &self.g; 678 if *value > 255i64 { 679 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 680 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("g"), 681 max: 255i64, 682 actual: *value, 683 }); ··· 687 let value = &self.g; 688 if *value < 0i64 { 689 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 690 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("g"), 691 min: 0i64, 692 actual: *value, 693 }); ··· 697 let value = &self.r; 698 if *value > 255i64 { 699 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 700 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("r"), 701 max: 255i64, 702 actual: *value, 703 }); ··· 707 let value = &self.r; 708 if *value < 0i64 { 709 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 710 - path: ::jacquard_lexicon::validation::ValidationPath::from_field("r"), 711 min: 0i64, 712 actual: *value, 713 }); ··· 715 } 716 Ok(()) 717 } 718 - }
··· 7 8 #[jacquard_derive::lexicon] 9 #[derive( 10 + serde::Serialize, 11 + serde::Deserialize, 12 + Debug, 13 + Clone, 14 + PartialEq, 15 + Eq, 16 + jacquard_derive::IntoStatic 17 )] 18 #[serde(rename_all = "camelCase")] 19 pub struct Rgb<'a> { ··· 24 25 pub mod rgb_state { 26 27 + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 28 #[allow(unused)] 29 use ::core::marker::PhantomData; 30 mod sealed { ··· 32 } 33 /// State trait tracking which required fields have been set 34 pub trait State: sealed::Sealed { 35 + type G; 36 type B; 37 type R; 38 } 39 /// Empty state - all required fields are unset 40 pub struct Empty(()); 41 impl sealed::Sealed for Empty {} 42 impl State for Empty { 43 + type G = Unset; 44 type B = Unset; 45 type R = Unset; 46 + } 47 + ///State transition - sets the `g` field to Set 48 + pub struct SetG<S: State = Empty>(PhantomData<fn() -> S>); 49 + impl<S: State> sealed::Sealed for SetG<S> {} 50 + impl<S: State> State for SetG<S> { 51 + type G = Set<members::g>; 52 + type B = S::B; 53 + type R = S::R; 54 } 55 ///State transition - sets the `b` field to Set 56 pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); 57 impl<S: State> sealed::Sealed for SetB<S> {} 58 impl<S: State> State for SetB<S> { 59 + type G = S::G; 60 type B = Set<members::b>; 61 type R = S::R; 62 } 63 ///State transition - sets the `r` field to Set 64 pub struct SetR<S: State = Empty>(PhantomData<fn() -> S>); 65 impl<S: State> sealed::Sealed for SetR<S> {} 66 impl<S: State> State for SetR<S> { 67 + type G = S::G; 68 type B = S::B; 69 type R = Set<members::r>; 70 } 71 /// Marker types for field names 72 #[allow(non_camel_case_types)] 73 pub mod members { 74 + ///Marker type for the `g` field 75 + pub struct g(()); 76 ///Marker type for the `b` field 77 pub struct b(()); 78 ///Marker type for the `r` field 79 pub struct r(()); 80 } 81 } 82 ··· 160 impl<'a, S> RgbBuilder<'a, S> 161 where 162 S: rgb_state::State, 163 + S::G: rgb_state::IsSet, 164 S::B: rgb_state::IsSet, 165 S::R: rgb_state::IsSet, 166 { 167 /// Build the final struct 168 pub fn build(self) -> Rgb<'a> { ··· 190 } 191 } 192 193 + fn lexicon_doc_site_standard_theme_color() -> ::jacquard_lexicon::lexicon::LexiconDoc< 194 + 'static, 195 + > { 196 ::jacquard_lexicon::lexicon::LexiconDoc { 197 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 198 id: ::jacquard_common::CowStr::new_static("site.standard.theme.color"), ··· 202 let mut map = ::std::collections::BTreeMap::new(); 203 map.insert( 204 ::jacquard_common::smol_str::SmolStr::new_static("rgb"), 205 + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 206 + description: None, 207 + required: Some( 208 + vec![ 209 ::jacquard_common::smol_str::SmolStr::new_static("r"), 210 ::jacquard_common::smol_str::SmolStr::new_static("g"), 211 + ::jacquard_common::smol_str::SmolStr::new_static("b") 212 + ], 213 + ), 214 + nullable: None, 215 + properties: { 216 + #[allow(unused_mut)] 217 + let mut map = ::std::collections::BTreeMap::new(); 218 + map.insert( 219 ::jacquard_common::smol_str::SmolStr::new_static("b"), 220 + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 221 + description: None, 222 + default: None, 223 + minimum: Some(0i64), 224 + maximum: Some(255i64), 225 + r#enum: None, 226 + r#const: None, 227 + }), 228 + ); 229 + map.insert( 230 + ::jacquard_common::smol_str::SmolStr::new_static("g"), 231 + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 232 + description: None, 233 + default: None, 234 + minimum: Some(0i64), 235 + maximum: Some(255i64), 236 + r#enum: None, 237 + r#const: None, 238 + }), 239 + ); 240 + map.insert( 241 + ::jacquard_common::smol_str::SmolStr::new_static("r"), 242 + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 243 + description: None, 244 + default: None, 245 + minimum: Some(0i64), 246 + maximum: Some(255i64), 247 + r#enum: None, 248 + r#const: None, 249 + }), 250 + ); 251 + map 252 }, 253 + }), 254 ); 255 map.insert( 256 ::jacquard_common::smol_str::SmolStr::new_static("rgba"), 257 + ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 258 + description: None, 259 + required: Some( 260 + vec![ 261 ::jacquard_common::smol_str::SmolStr::new_static("r"), 262 ::jacquard_common::smol_str::SmolStr::new_static("g"), 263 ::jacquard_common::smol_str::SmolStr::new_static("b"), 264 + ::jacquard_common::smol_str::SmolStr::new_static("a") 265 + ], 266 + ), 267 + nullable: None, 268 + properties: { 269 + #[allow(unused_mut)] 270 + let mut map = ::std::collections::BTreeMap::new(); 271 + map.insert( 272 ::jacquard_common::smol_str::SmolStr::new_static("a"), 273 + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 274 + description: None, 275 + default: None, 276 + minimum: Some(0i64), 277 + maximum: Some(100i64), 278 + r#enum: None, 279 + r#const: None, 280 + }), 281 + ); 282 + map.insert( 283 + ::jacquard_common::smol_str::SmolStr::new_static("b"), 284 + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 285 + description: None, 286 + default: None, 287 + minimum: Some(0i64), 288 + maximum: Some(255i64), 289 + r#enum: None, 290 + r#const: None, 291 + }), 292 + ); 293 + map.insert( 294 + ::jacquard_common::smol_str::SmolStr::new_static("g"), 295 + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 296 + description: None, 297 + default: None, 298 + minimum: Some(0i64), 299 + maximum: Some(255i64), 300 + r#enum: None, 301 + r#const: None, 302 + }), 303 + ); 304 + map.insert( 305 + ::jacquard_common::smol_str::SmolStr::new_static("r"), 306 + ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 307 + description: None, 308 + default: None, 309 + minimum: Some(0i64), 310 + maximum: Some(255i64), 311 + r#enum: None, 312 + r#const: None, 313 + }), 314 + ); 315 + map 316 }, 317 + }), 318 ); 319 map 320 }, ··· 338 let value = &self.b; 339 if *value > 255i64 { 340 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 341 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 342 + "b", 343 + ), 344 max: 255i64, 345 actual: *value, 346 }); ··· 350 let value = &self.b; 351 if *value < 0i64 { 352 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 353 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 354 + "b", 355 + ), 356 min: 0i64, 357 actual: *value, 358 }); ··· 362 let value = &self.g; 363 if *value > 255i64 { 364 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 365 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 366 + "g", 367 + ), 368 max: 255i64, 369 actual: *value, 370 }); ··· 374 let value = &self.g; 375 if *value < 0i64 { 376 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 377 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 378 + "g", 379 + ), 380 min: 0i64, 381 actual: *value, 382 }); ··· 386 let value = &self.r; 387 if *value > 255i64 { 388 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 389 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 390 + "r", 391 + ), 392 max: 255i64, 393 actual: *value, 394 }); ··· 398 let value = &self.r; 399 if *value < 0i64 { 400 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 401 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 402 + "r", 403 + ), 404 min: 0i64, 405 actual: *value, 406 }); ··· 412 413 #[jacquard_derive::lexicon] 414 #[derive( 415 + serde::Serialize, 416 + serde::Deserialize, 417 + Debug, 418 + Clone, 419 + PartialEq, 420 + Eq, 421 + jacquard_derive::IntoStatic 422 )] 423 #[serde(rename_all = "camelCase")] 424 pub struct Rgba<'a> { ··· 430 431 pub mod rgba_state { 432 433 + pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 434 #[allow(unused)] 435 use ::core::marker::PhantomData; 436 mod sealed { ··· 439 /// State trait tracking which required fields have been set 440 pub trait State: sealed::Sealed { 441 type A; 442 + type G; 443 type R; 444 type B; 445 } 446 /// Empty state - all required fields are unset 447 pub struct Empty(()); 448 impl sealed::Sealed for Empty {} 449 impl State for Empty { 450 type A = Unset; 451 + type G = Unset; 452 type R = Unset; 453 type B = Unset; 454 } 455 ///State transition - sets the `a` field to Set 456 pub struct SetA<S: State = Empty>(PhantomData<fn() -> S>); 457 impl<S: State> sealed::Sealed for SetA<S> {} 458 impl<S: State> State for SetA<S> { 459 type A = Set<members::a>; 460 + type G = S::G; 461 type R = S::R; 462 type B = S::B; 463 + } 464 + ///State transition - sets the `g` field to Set 465 + pub struct SetG<S: State = Empty>(PhantomData<fn() -> S>); 466 + impl<S: State> sealed::Sealed for SetG<S> {} 467 + impl<S: State> State for SetG<S> { 468 + type A = S::A; 469 + type G = Set<members::g>; 470 + type R = S::R; 471 + type B = S::B; 472 } 473 ///State transition - sets the `r` field to Set 474 pub struct SetR<S: State = Empty>(PhantomData<fn() -> S>); 475 impl<S: State> sealed::Sealed for SetR<S> {} 476 impl<S: State> State for SetR<S> { 477 type A = S::A; 478 + type G = S::G; 479 type R = Set<members::r>; 480 type B = S::B; 481 } 482 ///State transition - sets the `b` field to Set 483 pub struct SetB<S: State = Empty>(PhantomData<fn() -> S>); 484 impl<S: State> sealed::Sealed for SetB<S> {} 485 impl<S: State> State for SetB<S> { 486 type A = S::A; 487 type G = S::G; 488 type R = S::R; 489 + type B = Set<members::b>; 490 } 491 /// Marker types for field names 492 #[allow(non_camel_case_types)] 493 pub mod members { 494 ///Marker type for the `a` field 495 pub struct a(()); 496 + ///Marker type for the `g` field 497 + pub struct g(()); 498 ///Marker type for the `r` field 499 pub struct r(()); 500 ///Marker type for the `b` field 501 pub struct b(()); 502 } 503 } 504 ··· 600 where 601 S: rgba_state::State, 602 S::A: rgba_state::IsSet, 603 + S::G: rgba_state::IsSet, 604 S::R: rgba_state::IsSet, 605 S::B: rgba_state::IsSet, 606 { 607 /// Build the final struct 608 pub fn build(self) -> Rgba<'a> { ··· 649 let value = &self.a; 650 if *value > 100i64 { 651 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 652 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 653 + "a", 654 + ), 655 max: 100i64, 656 actual: *value, 657 }); ··· 661 let value = &self.a; 662 if *value < 0i64 { 663 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 664 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 665 + "a", 666 + ), 667 min: 0i64, 668 actual: *value, 669 }); ··· 673 let value = &self.b; 674 if *value > 255i64 { 675 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 676 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 677 + "b", 678 + ), 679 max: 255i64, 680 actual: *value, 681 }); ··· 685 let value = &self.b; 686 if *value < 0i64 { 687 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 688 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 689 + "b", 690 + ), 691 min: 0i64, 692 actual: *value, 693 }); ··· 697 let value = &self.g; 698 if *value > 255i64 { 699 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 700 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 701 + "g", 702 + ), 703 max: 255i64, 704 actual: *value, 705 }); ··· 709 let value = &self.g; 710 if *value < 0i64 { 711 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 712 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 713 + "g", 714 + ), 715 min: 0i64, 716 actual: *value, 717 }); ··· 721 let value = &self.r; 722 if *value > 255i64 { 723 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 724 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 725 + "r", 726 + ), 727 max: 255i64, 728 actual: *value, 729 }); ··· 733 let value = &self.r; 734 if *value < 0i64 { 735 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 736 + path: ::jacquard_lexicon::validation::ValidationPath::from_field( 737 + "r", 738 + ), 739 min: 0i64, 740 actual: *value, 741 }); ··· 743 } 744 Ok(()) 745 } 746 + }