atproto blogging
at main 765 lines 29 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.graph.starterpack 4// 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, 11 serde::Deserialize, 12 Debug, 13 Clone, 14 PartialEq, 15 Eq, 16 jacquard_derive::IntoStatic 17)] 18#[serde(rename_all = "camelCase")] 19pub struct FeedItem<'a> { 20 #[serde(borrow)] 21 pub uri: jacquard_common::types::string::AtUri<'a>, 22} 23 24pub mod feed_item_state { 25 26 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 27 #[allow(unused)] 28 use ::core::marker::PhantomData; 29 mod sealed { 30 pub trait Sealed {} 31 } 32 /// State trait tracking which required fields have been set 33 pub trait State: sealed::Sealed { 34 type Uri; 35 } 36 /// Empty state - all required fields are unset 37 pub struct Empty(()); 38 impl sealed::Sealed for Empty {} 39 impl State for Empty { 40 type Uri = Unset; 41 } 42 ///State transition - sets the `uri` field to Set 43 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>); 44 impl<S: State> sealed::Sealed for SetUri<S> {} 45 impl<S: State> State for SetUri<S> { 46 type Uri = Set<members::uri>; 47 } 48 /// Marker types for field names 49 #[allow(non_camel_case_types)] 50 pub mod members { 51 ///Marker type for the `uri` field 52 pub struct uri(()); 53 } 54} 55 56/// Builder for constructing an instance of this type 57pub struct FeedItemBuilder<'a, S: feed_item_state::State> { 58 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 59 __unsafe_private_named: ( 60 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 61 ), 62 _phantom: ::core::marker::PhantomData<&'a ()>, 63} 64 65impl<'a> FeedItem<'a> { 66 /// Create a new builder for this type 67 pub fn new() -> FeedItemBuilder<'a, feed_item_state::Empty> { 68 FeedItemBuilder::new() 69 } 70} 71 72impl<'a> FeedItemBuilder<'a, feed_item_state::Empty> { 73 /// Create a new builder with all fields unset 74 pub fn new() -> Self { 75 FeedItemBuilder { 76 _phantom_state: ::core::marker::PhantomData, 77 __unsafe_private_named: (None,), 78 _phantom: ::core::marker::PhantomData, 79 } 80 } 81} 82 83impl<'a, S> FeedItemBuilder<'a, S> 84where 85 S: feed_item_state::State, 86 S::Uri: feed_item_state::IsUnset, 87{ 88 /// Set the `uri` field (required) 89 pub fn uri( 90 mut self, 91 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 92 ) -> FeedItemBuilder<'a, feed_item_state::SetUri<S>> { 93 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 94 FeedItemBuilder { 95 _phantom_state: ::core::marker::PhantomData, 96 __unsafe_private_named: self.__unsafe_private_named, 97 _phantom: ::core::marker::PhantomData, 98 } 99 } 100} 101 102impl<'a, S> FeedItemBuilder<'a, S> 103where 104 S: feed_item_state::State, 105 S::Uri: feed_item_state::IsSet, 106{ 107 /// Build the final struct 108 pub fn build(self) -> FeedItem<'a> { 109 FeedItem { 110 uri: self.__unsafe_private_named.0.unwrap(), 111 extra_data: Default::default(), 112 } 113 } 114 /// Build the final struct with custom extra_data 115 pub fn build_with_data( 116 self, 117 extra_data: std::collections::BTreeMap< 118 jacquard_common::smol_str::SmolStr, 119 jacquard_common::types::value::Data<'a>, 120 >, 121 ) -> FeedItem<'a> { 122 FeedItem { 123 uri: self.__unsafe_private_named.0.unwrap(), 124 extra_data: Some(extra_data), 125 } 126 } 127} 128 129fn lexicon_doc_app_bsky_graph_starterpack() -> ::jacquard_lexicon::lexicon::LexiconDoc< 130 'static, 131> { 132 ::jacquard_lexicon::lexicon::LexiconDoc { 133 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 134 id: ::jacquard_common::CowStr::new_static("app.bsky.graph.starterpack"), 135 revision: None, 136 description: None, 137 defs: { 138 let mut map = ::alloc::collections::BTreeMap::new(); 139 map.insert( 140 ::jacquard_common::smol_str::SmolStr::new_static("feedItem"), 141 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 142 description: None, 143 required: Some( 144 vec![::jacquard_common::smol_str::SmolStr::new_static("uri")], 145 ), 146 nullable: None, 147 properties: { 148 #[allow(unused_mut)] 149 let mut map = ::alloc::collections::BTreeMap::new(); 150 map.insert( 151 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 152 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 153 description: None, 154 format: Some( 155 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 156 ), 157 default: None, 158 min_length: None, 159 max_length: None, 160 min_graphemes: None, 161 max_graphemes: None, 162 r#enum: None, 163 r#const: None, 164 known_values: None, 165 }), 166 ); 167 map 168 }, 169 }), 170 ); 171 map.insert( 172 ::jacquard_common::smol_str::SmolStr::new_static("main"), 173 ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { 174 description: Some( 175 ::jacquard_common::CowStr::new_static( 176 "Record defining a starter pack of actors and feeds for new users.", 177 ), 178 ), 179 key: Some(::jacquard_common::CowStr::new_static("tid")), 180 record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { 181 description: None, 182 required: Some( 183 vec![ 184 ::jacquard_common::smol_str::SmolStr::new_static("name"), 185 ::jacquard_common::smol_str::SmolStr::new_static("list"), 186 ::jacquard_common::smol_str::SmolStr::new_static("createdAt") 187 ], 188 ), 189 nullable: None, 190 properties: { 191 #[allow(unused_mut)] 192 let mut map = ::alloc::collections::BTreeMap::new(); 193 map.insert( 194 ::jacquard_common::smol_str::SmolStr::new_static( 195 "createdAt", 196 ), 197 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 198 description: None, 199 format: Some( 200 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 201 ), 202 default: None, 203 min_length: None, 204 max_length: None, 205 min_graphemes: None, 206 max_graphemes: None, 207 r#enum: None, 208 r#const: None, 209 known_values: None, 210 }), 211 ); 212 map.insert( 213 ::jacquard_common::smol_str::SmolStr::new_static( 214 "description", 215 ), 216 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 217 description: None, 218 format: None, 219 default: None, 220 min_length: None, 221 max_length: Some(3000usize), 222 min_graphemes: None, 223 max_graphemes: Some(300usize), 224 r#enum: None, 225 r#const: None, 226 known_values: None, 227 }), 228 ); 229 map.insert( 230 ::jacquard_common::smol_str::SmolStr::new_static( 231 "descriptionFacets", 232 ), 233 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 234 description: None, 235 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 236 description: None, 237 r#ref: ::jacquard_common::CowStr::new_static( 238 "app.bsky.richtext.facet", 239 ), 240 }), 241 min_length: None, 242 max_length: None, 243 }), 244 ); 245 map.insert( 246 ::jacquard_common::smol_str::SmolStr::new_static("feeds"), 247 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 248 description: None, 249 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 250 description: None, 251 r#ref: ::jacquard_common::CowStr::new_static("#feedItem"), 252 }), 253 min_length: None, 254 max_length: Some(3usize), 255 }), 256 ); 257 map.insert( 258 ::jacquard_common::smol_str::SmolStr::new_static("list"), 259 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 260 description: Some( 261 ::jacquard_common::CowStr::new_static( 262 "Reference (AT-URI) to the list record.", 263 ), 264 ), 265 format: Some( 266 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 267 ), 268 default: None, 269 min_length: None, 270 max_length: None, 271 min_graphemes: None, 272 max_graphemes: None, 273 r#enum: None, 274 r#const: None, 275 known_values: None, 276 }), 277 ); 278 map.insert( 279 ::jacquard_common::smol_str::SmolStr::new_static("name"), 280 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 281 description: Some( 282 ::jacquard_common::CowStr::new_static( 283 "Display name for starter pack; can not be empty.", 284 ), 285 ), 286 format: None, 287 default: None, 288 min_length: Some(1usize), 289 max_length: Some(500usize), 290 min_graphemes: None, 291 max_graphemes: Some(50usize), 292 r#enum: None, 293 r#const: None, 294 known_values: None, 295 }), 296 ); 297 map 298 }, 299 }), 300 }), 301 ); 302 map 303 }, 304 } 305} 306 307impl<'a> ::jacquard_lexicon::schema::LexiconSchema for FeedItem<'a> { 308 fn nsid() -> &'static str { 309 "app.bsky.graph.starterpack" 310 } 311 fn def_name() -> &'static str { 312 "feedItem" 313 } 314 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 315 lexicon_doc_app_bsky_graph_starterpack() 316 } 317 fn validate( 318 &self, 319 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 320 Ok(()) 321 } 322} 323 324/// Record defining a starter pack of actors and feeds for new users. 325#[jacquard_derive::lexicon] 326#[derive( 327 serde::Serialize, 328 serde::Deserialize, 329 Debug, 330 Clone, 331 PartialEq, 332 Eq, 333 jacquard_derive::IntoStatic 334)] 335#[serde(rename_all = "camelCase")] 336pub struct Starterpack<'a> { 337 pub created_at: jacquard_common::types::string::Datetime, 338 #[serde(skip_serializing_if = "std::option::Option::is_none")] 339 #[serde(borrow)] 340 pub description: std::option::Option<jacquard_common::CowStr<'a>>, 341 #[serde(skip_serializing_if = "std::option::Option::is_none")] 342 #[serde(borrow)] 343 pub description_facets: std::option::Option< 344 Vec<crate::app_bsky::richtext::facet::Facet<'a>>, 345 >, 346 #[serde(skip_serializing_if = "std::option::Option::is_none")] 347 #[serde(borrow)] 348 pub feeds: std::option::Option< 349 Vec<crate::app_bsky::graph::starterpack::FeedItem<'a>>, 350 >, 351 /// Reference (AT-URI) to the list record. 352 #[serde(borrow)] 353 pub list: jacquard_common::types::string::AtUri<'a>, 354 /// Display name for starter pack; can not be empty. 355 #[serde(borrow)] 356 pub name: jacquard_common::CowStr<'a>, 357} 358 359pub mod starterpack_state { 360 361 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 362 #[allow(unused)] 363 use ::core::marker::PhantomData; 364 mod sealed { 365 pub trait Sealed {} 366 } 367 /// State trait tracking which required fields have been set 368 pub trait State: sealed::Sealed { 369 type List; 370 type Name; 371 type CreatedAt; 372 } 373 /// Empty state - all required fields are unset 374 pub struct Empty(()); 375 impl sealed::Sealed for Empty {} 376 impl State for Empty { 377 type List = Unset; 378 type Name = Unset; 379 type CreatedAt = Unset; 380 } 381 ///State transition - sets the `list` field to Set 382 pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>); 383 impl<S: State> sealed::Sealed for SetList<S> {} 384 impl<S: State> State for SetList<S> { 385 type List = Set<members::list>; 386 type Name = S::Name; 387 type CreatedAt = S::CreatedAt; 388 } 389 ///State transition - sets the `name` field to Set 390 pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); 391 impl<S: State> sealed::Sealed for SetName<S> {} 392 impl<S: State> State for SetName<S> { 393 type List = S::List; 394 type Name = Set<members::name>; 395 type CreatedAt = S::CreatedAt; 396 } 397 ///State transition - sets the `created_at` field to Set 398 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); 399 impl<S: State> sealed::Sealed for SetCreatedAt<S> {} 400 impl<S: State> State for SetCreatedAt<S> { 401 type List = S::List; 402 type Name = S::Name; 403 type CreatedAt = Set<members::created_at>; 404 } 405 /// Marker types for field names 406 #[allow(non_camel_case_types)] 407 pub mod members { 408 ///Marker type for the `list` field 409 pub struct list(()); 410 ///Marker type for the `name` field 411 pub struct name(()); 412 ///Marker type for the `created_at` field 413 pub struct created_at(()); 414 } 415} 416 417/// Builder for constructing an instance of this type 418pub struct StarterpackBuilder<'a, S: starterpack_state::State> { 419 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 420 __unsafe_private_named: ( 421 ::core::option::Option<jacquard_common::types::string::Datetime>, 422 ::core::option::Option<jacquard_common::CowStr<'a>>, 423 ::core::option::Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>, 424 ::core::option::Option<Vec<crate::app_bsky::graph::starterpack::FeedItem<'a>>>, 425 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 426 ::core::option::Option<jacquard_common::CowStr<'a>>, 427 ), 428 _phantom: ::core::marker::PhantomData<&'a ()>, 429} 430 431impl<'a> Starterpack<'a> { 432 /// Create a new builder for this type 433 pub fn new() -> StarterpackBuilder<'a, starterpack_state::Empty> { 434 StarterpackBuilder::new() 435 } 436} 437 438impl<'a> StarterpackBuilder<'a, starterpack_state::Empty> { 439 /// Create a new builder with all fields unset 440 pub fn new() -> Self { 441 StarterpackBuilder { 442 _phantom_state: ::core::marker::PhantomData, 443 __unsafe_private_named: (None, None, None, None, None, None), 444 _phantom: ::core::marker::PhantomData, 445 } 446 } 447} 448 449impl<'a, S> StarterpackBuilder<'a, S> 450where 451 S: starterpack_state::State, 452 S::CreatedAt: starterpack_state::IsUnset, 453{ 454 /// Set the `createdAt` field (required) 455 pub fn created_at( 456 mut self, 457 value: impl Into<jacquard_common::types::string::Datetime>, 458 ) -> StarterpackBuilder<'a, starterpack_state::SetCreatedAt<S>> { 459 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 460 StarterpackBuilder { 461 _phantom_state: ::core::marker::PhantomData, 462 __unsafe_private_named: self.__unsafe_private_named, 463 _phantom: ::core::marker::PhantomData, 464 } 465 } 466} 467 468impl<'a, S: starterpack_state::State> StarterpackBuilder<'a, S> { 469 /// Set the `description` field (optional) 470 pub fn description( 471 mut self, 472 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 473 ) -> Self { 474 self.__unsafe_private_named.1 = value.into(); 475 self 476 } 477 /// Set the `description` field to an Option value (optional) 478 pub fn maybe_description( 479 mut self, 480 value: Option<jacquard_common::CowStr<'a>>, 481 ) -> Self { 482 self.__unsafe_private_named.1 = value; 483 self 484 } 485} 486 487impl<'a, S: starterpack_state::State> StarterpackBuilder<'a, S> { 488 /// Set the `descriptionFacets` field (optional) 489 pub fn description_facets( 490 mut self, 491 value: impl Into<Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>>, 492 ) -> Self { 493 self.__unsafe_private_named.2 = value.into(); 494 self 495 } 496 /// Set the `descriptionFacets` field to an Option value (optional) 497 pub fn maybe_description_facets( 498 mut self, 499 value: Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>, 500 ) -> Self { 501 self.__unsafe_private_named.2 = value; 502 self 503 } 504} 505 506impl<'a, S: starterpack_state::State> StarterpackBuilder<'a, S> { 507 /// Set the `feeds` field (optional) 508 pub fn feeds( 509 mut self, 510 value: impl Into<Option<Vec<crate::app_bsky::graph::starterpack::FeedItem<'a>>>>, 511 ) -> Self { 512 self.__unsafe_private_named.3 = value.into(); 513 self 514 } 515 /// Set the `feeds` field to an Option value (optional) 516 pub fn maybe_feeds( 517 mut self, 518 value: Option<Vec<crate::app_bsky::graph::starterpack::FeedItem<'a>>>, 519 ) -> Self { 520 self.__unsafe_private_named.3 = value; 521 self 522 } 523} 524 525impl<'a, S> StarterpackBuilder<'a, S> 526where 527 S: starterpack_state::State, 528 S::List: starterpack_state::IsUnset, 529{ 530 /// Set the `list` field (required) 531 pub fn list( 532 mut self, 533 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 534 ) -> StarterpackBuilder<'a, starterpack_state::SetList<S>> { 535 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); 536 StarterpackBuilder { 537 _phantom_state: ::core::marker::PhantomData, 538 __unsafe_private_named: self.__unsafe_private_named, 539 _phantom: ::core::marker::PhantomData, 540 } 541 } 542} 543 544impl<'a, S> StarterpackBuilder<'a, S> 545where 546 S: starterpack_state::State, 547 S::Name: starterpack_state::IsUnset, 548{ 549 /// Set the `name` field (required) 550 pub fn name( 551 mut self, 552 value: impl Into<jacquard_common::CowStr<'a>>, 553 ) -> StarterpackBuilder<'a, starterpack_state::SetName<S>> { 554 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); 555 StarterpackBuilder { 556 _phantom_state: ::core::marker::PhantomData, 557 __unsafe_private_named: self.__unsafe_private_named, 558 _phantom: ::core::marker::PhantomData, 559 } 560 } 561} 562 563impl<'a, S> StarterpackBuilder<'a, S> 564where 565 S: starterpack_state::State, 566 S::List: starterpack_state::IsSet, 567 S::Name: starterpack_state::IsSet, 568 S::CreatedAt: starterpack_state::IsSet, 569{ 570 /// Build the final struct 571 pub fn build(self) -> Starterpack<'a> { 572 Starterpack { 573 created_at: self.__unsafe_private_named.0.unwrap(), 574 description: self.__unsafe_private_named.1, 575 description_facets: self.__unsafe_private_named.2, 576 feeds: self.__unsafe_private_named.3, 577 list: self.__unsafe_private_named.4.unwrap(), 578 name: self.__unsafe_private_named.5.unwrap(), 579 extra_data: Default::default(), 580 } 581 } 582 /// Build the final struct with custom extra_data 583 pub fn build_with_data( 584 self, 585 extra_data: std::collections::BTreeMap< 586 jacquard_common::smol_str::SmolStr, 587 jacquard_common::types::value::Data<'a>, 588 >, 589 ) -> Starterpack<'a> { 590 Starterpack { 591 created_at: self.__unsafe_private_named.0.unwrap(), 592 description: self.__unsafe_private_named.1, 593 description_facets: self.__unsafe_private_named.2, 594 feeds: self.__unsafe_private_named.3, 595 list: self.__unsafe_private_named.4.unwrap(), 596 name: self.__unsafe_private_named.5.unwrap(), 597 extra_data: Some(extra_data), 598 } 599 } 600} 601 602impl<'a> Starterpack<'a> { 603 pub fn uri( 604 uri: impl Into<jacquard_common::CowStr<'a>>, 605 ) -> Result< 606 jacquard_common::types::uri::RecordUri<'a, StarterpackRecord>, 607 jacquard_common::types::uri::UriError, 608 > { 609 jacquard_common::types::uri::RecordUri::try_from_uri( 610 jacquard_common::types::string::AtUri::new_cow(uri.into())?, 611 ) 612 } 613} 614 615/// Typed wrapper for GetRecord response with this collection's record type. 616#[derive( 617 serde::Serialize, 618 serde::Deserialize, 619 Debug, 620 Clone, 621 PartialEq, 622 Eq, 623 jacquard_derive::IntoStatic 624)] 625#[serde(rename_all = "camelCase")] 626pub struct StarterpackGetRecordOutput<'a> { 627 #[serde(skip_serializing_if = "std::option::Option::is_none")] 628 #[serde(borrow)] 629 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 630 #[serde(borrow)] 631 pub uri: jacquard_common::types::string::AtUri<'a>, 632 #[serde(borrow)] 633 pub value: Starterpack<'a>, 634} 635 636impl From<StarterpackGetRecordOutput<'_>> for Starterpack<'_> { 637 fn from(output: StarterpackGetRecordOutput<'_>) -> Self { 638 use jacquard_common::IntoStatic; 639 output.value.into_static() 640 } 641} 642 643impl jacquard_common::types::collection::Collection for Starterpack<'_> { 644 const NSID: &'static str = "app.bsky.graph.starterpack"; 645 type Record = StarterpackRecord; 646} 647 648/// Marker type for deserializing records from this collection. 649#[derive(Debug, serde::Serialize, serde::Deserialize)] 650pub struct StarterpackRecord; 651impl jacquard_common::xrpc::XrpcResp for StarterpackRecord { 652 const NSID: &'static str = "app.bsky.graph.starterpack"; 653 const ENCODING: &'static str = "application/json"; 654 type Output<'de> = StarterpackGetRecordOutput<'de>; 655 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 656} 657 658impl jacquard_common::types::collection::Collection for StarterpackRecord { 659 const NSID: &'static str = "app.bsky.graph.starterpack"; 660 type Record = StarterpackRecord; 661} 662 663impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Starterpack<'a> { 664 fn nsid() -> &'static str { 665 "app.bsky.graph.starterpack" 666 } 667 fn def_name() -> &'static str { 668 "main" 669 } 670 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 671 lexicon_doc_app_bsky_graph_starterpack() 672 } 673 fn validate( 674 &self, 675 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 676 if let Some(ref value) = self.description { 677 #[allow(unused_comparisons)] 678 if <str>::len(value.as_ref()) > 3000usize { 679 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 680 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 681 "description", 682 ), 683 max: 3000usize, 684 actual: <str>::len(value.as_ref()), 685 }); 686 } 687 } 688 if let Some(ref value) = self.description { 689 { 690 let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( 691 value.as_ref(), 692 true, 693 ) 694 .count(); 695 if count > 300usize { 696 return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 697 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 698 "description", 699 ), 700 max: 300usize, 701 actual: count, 702 }); 703 } 704 } 705 } 706 if let Some(ref value) = self.feeds { 707 #[allow(unused_comparisons)] 708 if value.len() > 3usize { 709 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 710 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 711 "feeds", 712 ), 713 max: 3usize, 714 actual: value.len(), 715 }); 716 } 717 } 718 { 719 let value = &self.name; 720 #[allow(unused_comparisons)] 721 if <str>::len(value.as_ref()) > 500usize { 722 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 723 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 724 "name", 725 ), 726 max: 500usize, 727 actual: <str>::len(value.as_ref()), 728 }); 729 } 730 } 731 { 732 let value = &self.name; 733 #[allow(unused_comparisons)] 734 if <str>::len(value.as_ref()) < 1usize { 735 return Err(::jacquard_lexicon::validation::ConstraintError::MinLength { 736 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 737 "name", 738 ), 739 min: 1usize, 740 actual: <str>::len(value.as_ref()), 741 }); 742 } 743 } 744 { 745 let value = &self.name; 746 { 747 let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( 748 value.as_ref(), 749 true, 750 ) 751 .count(); 752 if count > 50usize { 753 return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 754 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 755 "name", 756 ), 757 max: 50usize, 758 actual: count, 759 }); 760 } 761 } 762 } 763 Ok(()) 764 } 765}