Rust wrapper for the ATProto tap utility

Update lexicons

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