A better Rust ATProto crate
at cfedbbd0ad5cc113e262f47c2b2e47ea0405c331 694 lines 28 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: tools.ozone.setting.defs 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8pub mod list_options; 9pub mod remove_options; 10pub mod upsert_option; 11 12#[jacquard_derive::lexicon] 13#[derive( 14 serde::Serialize, 15 serde::Deserialize, 16 Debug, 17 Clone, 18 PartialEq, 19 Eq, 20 jacquard_derive::IntoStatic 21)] 22#[serde(rename_all = "camelCase")] 23pub struct DefsOption<'a> { 24 #[serde(skip_serializing_if = "std::option::Option::is_none")] 25 pub created_at: Option<jacquard_common::types::string::Datetime>, 26 #[serde(borrow)] 27 pub created_by: jacquard_common::types::string::Did<'a>, 28 #[serde(skip_serializing_if = "std::option::Option::is_none")] 29 #[serde(borrow)] 30 pub description: Option<jacquard_common::CowStr<'a>>, 31 #[serde(borrow)] 32 pub did: jacquard_common::types::string::Did<'a>, 33 #[serde(borrow)] 34 pub key: jacquard_common::types::string::Nsid<'a>, 35 #[serde(borrow)] 36 pub last_updated_by: jacquard_common::types::string::Did<'a>, 37 #[serde(skip_serializing_if = "std::option::Option::is_none")] 38 #[serde(borrow)] 39 pub manager_role: Option<jacquard_common::CowStr<'a>>, 40 #[serde(borrow)] 41 pub scope: jacquard_common::CowStr<'a>, 42 #[serde(skip_serializing_if = "std::option::Option::is_none")] 43 pub updated_at: Option<jacquard_common::types::string::Datetime>, 44 #[serde(borrow)] 45 pub value: jacquard_common::types::value::Data<'a>, 46} 47 48pub mod defs_option_state { 49 50 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 51 #[allow(unused)] 52 use ::core::marker::PhantomData; 53 mod sealed { 54 pub trait Sealed {} 55 } 56 /// State trait tracking which required fields have been set 57 pub trait State: sealed::Sealed { 58 type Key; 59 type Value; 60 type Did; 61 type Scope; 62 type CreatedBy; 63 type LastUpdatedBy; 64 } 65 /// Empty state - all required fields are unset 66 pub struct Empty(()); 67 impl sealed::Sealed for Empty {} 68 impl State for Empty { 69 type Key = Unset; 70 type Value = Unset; 71 type Did = Unset; 72 type Scope = Unset; 73 type CreatedBy = Unset; 74 type LastUpdatedBy = Unset; 75 } 76 ///State transition - sets the `key` field to Set 77 pub struct SetKey<S: State = Empty>(PhantomData<fn() -> S>); 78 impl<S: State> sealed::Sealed for SetKey<S> {} 79 impl<S: State> State for SetKey<S> { 80 type Key = Set<members::key>; 81 type Value = S::Value; 82 type Did = S::Did; 83 type Scope = S::Scope; 84 type CreatedBy = S::CreatedBy; 85 type LastUpdatedBy = S::LastUpdatedBy; 86 } 87 ///State transition - sets the `value` field to Set 88 pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>); 89 impl<S: State> sealed::Sealed for SetValue<S> {} 90 impl<S: State> State for SetValue<S> { 91 type Key = S::Key; 92 type Value = Set<members::value>; 93 type Did = S::Did; 94 type Scope = S::Scope; 95 type CreatedBy = S::CreatedBy; 96 type LastUpdatedBy = S::LastUpdatedBy; 97 } 98 ///State transition - sets the `did` field to Set 99 pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); 100 impl<S: State> sealed::Sealed for SetDid<S> {} 101 impl<S: State> State for SetDid<S> { 102 type Key = S::Key; 103 type Value = S::Value; 104 type Did = Set<members::did>; 105 type Scope = S::Scope; 106 type CreatedBy = S::CreatedBy; 107 type LastUpdatedBy = S::LastUpdatedBy; 108 } 109 ///State transition - sets the `scope` field to Set 110 pub struct SetScope<S: State = Empty>(PhantomData<fn() -> S>); 111 impl<S: State> sealed::Sealed for SetScope<S> {} 112 impl<S: State> State for SetScope<S> { 113 type Key = S::Key; 114 type Value = S::Value; 115 type Did = S::Did; 116 type Scope = Set<members::scope>; 117 type CreatedBy = S::CreatedBy; 118 type LastUpdatedBy = S::LastUpdatedBy; 119 } 120 ///State transition - sets the `created_by` field to Set 121 pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>); 122 impl<S: State> sealed::Sealed for SetCreatedBy<S> {} 123 impl<S: State> State for SetCreatedBy<S> { 124 type Key = S::Key; 125 type Value = S::Value; 126 type Did = S::Did; 127 type Scope = S::Scope; 128 type CreatedBy = Set<members::created_by>; 129 type LastUpdatedBy = S::LastUpdatedBy; 130 } 131 ///State transition - sets the `last_updated_by` field to Set 132 pub struct SetLastUpdatedBy<S: State = Empty>(PhantomData<fn() -> S>); 133 impl<S: State> sealed::Sealed for SetLastUpdatedBy<S> {} 134 impl<S: State> State for SetLastUpdatedBy<S> { 135 type Key = S::Key; 136 type Value = S::Value; 137 type Did = S::Did; 138 type Scope = S::Scope; 139 type CreatedBy = S::CreatedBy; 140 type LastUpdatedBy = Set<members::last_updated_by>; 141 } 142 /// Marker types for field names 143 #[allow(non_camel_case_types)] 144 pub mod members { 145 ///Marker type for the `key` field 146 pub struct key(()); 147 ///Marker type for the `value` field 148 pub struct value(()); 149 ///Marker type for the `did` field 150 pub struct did(()); 151 ///Marker type for the `scope` field 152 pub struct scope(()); 153 ///Marker type for the `created_by` field 154 pub struct created_by(()); 155 ///Marker type for the `last_updated_by` field 156 pub struct last_updated_by(()); 157 } 158} 159 160/// Builder for constructing an instance of this type 161pub struct DefsOptionBuilder<'a, S: defs_option_state::State> { 162 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 163 __unsafe_private_named: ( 164 ::core::option::Option<jacquard_common::types::string::Datetime>, 165 ::core::option::Option<jacquard_common::types::string::Did<'a>>, 166 ::core::option::Option<jacquard_common::CowStr<'a>>, 167 ::core::option::Option<jacquard_common::types::string::Did<'a>>, 168 ::core::option::Option<jacquard_common::types::string::Nsid<'a>>, 169 ::core::option::Option<jacquard_common::types::string::Did<'a>>, 170 ::core::option::Option<jacquard_common::CowStr<'a>>, 171 ::core::option::Option<jacquard_common::CowStr<'a>>, 172 ::core::option::Option<jacquard_common::types::string::Datetime>, 173 ::core::option::Option<jacquard_common::types::value::Data<'a>>, 174 ), 175 _phantom: ::core::marker::PhantomData<&'a ()>, 176} 177 178impl<'a> DefsOption<'a> { 179 /// Create a new builder for this type 180 pub fn new() -> DefsOptionBuilder<'a, defs_option_state::Empty> { 181 DefsOptionBuilder::new() 182 } 183} 184 185impl<'a> DefsOptionBuilder<'a, defs_option_state::Empty> { 186 /// Create a new builder with all fields unset 187 pub fn new() -> Self { 188 DefsOptionBuilder { 189 _phantom_state: ::core::marker::PhantomData, 190 __unsafe_private_named: ( 191 None, 192 None, 193 None, 194 None, 195 None, 196 None, 197 None, 198 None, 199 None, 200 None, 201 ), 202 _phantom: ::core::marker::PhantomData, 203 } 204 } 205} 206 207impl<'a, S: defs_option_state::State> DefsOptionBuilder<'a, S> { 208 /// Set the `createdAt` field (optional) 209 pub fn created_at( 210 mut self, 211 value: impl Into<Option<jacquard_common::types::string::Datetime>>, 212 ) -> Self { 213 self.__unsafe_private_named.0 = value.into(); 214 self 215 } 216 /// Set the `createdAt` field to an Option value (optional) 217 pub fn maybe_created_at( 218 mut self, 219 value: Option<jacquard_common::types::string::Datetime>, 220 ) -> Self { 221 self.__unsafe_private_named.0 = value; 222 self 223 } 224} 225 226impl<'a, S> DefsOptionBuilder<'a, S> 227where 228 S: defs_option_state::State, 229 S::CreatedBy: defs_option_state::IsUnset, 230{ 231 /// Set the `createdBy` field (required) 232 pub fn created_by( 233 mut self, 234 value: impl Into<jacquard_common::types::string::Did<'a>>, 235 ) -> DefsOptionBuilder<'a, defs_option_state::SetCreatedBy<S>> { 236 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 237 DefsOptionBuilder { 238 _phantom_state: ::core::marker::PhantomData, 239 __unsafe_private_named: self.__unsafe_private_named, 240 _phantom: ::core::marker::PhantomData, 241 } 242 } 243} 244 245impl<'a, S: defs_option_state::State> DefsOptionBuilder<'a, S> { 246 /// Set the `description` field (optional) 247 pub fn description( 248 mut self, 249 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 250 ) -> Self { 251 self.__unsafe_private_named.2 = value.into(); 252 self 253 } 254 /// Set the `description` field to an Option value (optional) 255 pub fn maybe_description( 256 mut self, 257 value: Option<jacquard_common::CowStr<'a>>, 258 ) -> Self { 259 self.__unsafe_private_named.2 = value; 260 self 261 } 262} 263 264impl<'a, S> DefsOptionBuilder<'a, S> 265where 266 S: defs_option_state::State, 267 S::Did: defs_option_state::IsUnset, 268{ 269 /// Set the `did` field (required) 270 pub fn did( 271 mut self, 272 value: impl Into<jacquard_common::types::string::Did<'a>>, 273 ) -> DefsOptionBuilder<'a, defs_option_state::SetDid<S>> { 274 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); 275 DefsOptionBuilder { 276 _phantom_state: ::core::marker::PhantomData, 277 __unsafe_private_named: self.__unsafe_private_named, 278 _phantom: ::core::marker::PhantomData, 279 } 280 } 281} 282 283impl<'a, S> DefsOptionBuilder<'a, S> 284where 285 S: defs_option_state::State, 286 S::Key: defs_option_state::IsUnset, 287{ 288 /// Set the `key` field (required) 289 pub fn key( 290 mut self, 291 value: impl Into<jacquard_common::types::string::Nsid<'a>>, 292 ) -> DefsOptionBuilder<'a, defs_option_state::SetKey<S>> { 293 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); 294 DefsOptionBuilder { 295 _phantom_state: ::core::marker::PhantomData, 296 __unsafe_private_named: self.__unsafe_private_named, 297 _phantom: ::core::marker::PhantomData, 298 } 299 } 300} 301 302impl<'a, S> DefsOptionBuilder<'a, S> 303where 304 S: defs_option_state::State, 305 S::LastUpdatedBy: defs_option_state::IsUnset, 306{ 307 /// Set the `lastUpdatedBy` field (required) 308 pub fn last_updated_by( 309 mut self, 310 value: impl Into<jacquard_common::types::string::Did<'a>>, 311 ) -> DefsOptionBuilder<'a, defs_option_state::SetLastUpdatedBy<S>> { 312 self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); 313 DefsOptionBuilder { 314 _phantom_state: ::core::marker::PhantomData, 315 __unsafe_private_named: self.__unsafe_private_named, 316 _phantom: ::core::marker::PhantomData, 317 } 318 } 319} 320 321impl<'a, S: defs_option_state::State> DefsOptionBuilder<'a, S> { 322 /// Set the `managerRole` field (optional) 323 pub fn manager_role( 324 mut self, 325 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 326 ) -> Self { 327 self.__unsafe_private_named.6 = value.into(); 328 self 329 } 330 /// Set the `managerRole` field to an Option value (optional) 331 pub fn maybe_manager_role( 332 mut self, 333 value: Option<jacquard_common::CowStr<'a>>, 334 ) -> Self { 335 self.__unsafe_private_named.6 = value; 336 self 337 } 338} 339 340impl<'a, S> DefsOptionBuilder<'a, S> 341where 342 S: defs_option_state::State, 343 S::Scope: defs_option_state::IsUnset, 344{ 345 /// Set the `scope` field (required) 346 pub fn scope( 347 mut self, 348 value: impl Into<jacquard_common::CowStr<'a>>, 349 ) -> DefsOptionBuilder<'a, defs_option_state::SetScope<S>> { 350 self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); 351 DefsOptionBuilder { 352 _phantom_state: ::core::marker::PhantomData, 353 __unsafe_private_named: self.__unsafe_private_named, 354 _phantom: ::core::marker::PhantomData, 355 } 356 } 357} 358 359impl<'a, S: defs_option_state::State> DefsOptionBuilder<'a, S> { 360 /// Set the `updatedAt` field (optional) 361 pub fn updated_at( 362 mut self, 363 value: impl Into<Option<jacquard_common::types::string::Datetime>>, 364 ) -> Self { 365 self.__unsafe_private_named.8 = value.into(); 366 self 367 } 368 /// Set the `updatedAt` field to an Option value (optional) 369 pub fn maybe_updated_at( 370 mut self, 371 value: Option<jacquard_common::types::string::Datetime>, 372 ) -> Self { 373 self.__unsafe_private_named.8 = value; 374 self 375 } 376} 377 378impl<'a, S> DefsOptionBuilder<'a, S> 379where 380 S: defs_option_state::State, 381 S::Value: defs_option_state::IsUnset, 382{ 383 /// Set the `value` field (required) 384 pub fn value( 385 mut self, 386 value: impl Into<jacquard_common::types::value::Data<'a>>, 387 ) -> DefsOptionBuilder<'a, defs_option_state::SetValue<S>> { 388 self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into()); 389 DefsOptionBuilder { 390 _phantom_state: ::core::marker::PhantomData, 391 __unsafe_private_named: self.__unsafe_private_named, 392 _phantom: ::core::marker::PhantomData, 393 } 394 } 395} 396 397impl<'a, S> DefsOptionBuilder<'a, S> 398where 399 S: defs_option_state::State, 400 S::Key: defs_option_state::IsSet, 401 S::Value: defs_option_state::IsSet, 402 S::Did: defs_option_state::IsSet, 403 S::Scope: defs_option_state::IsSet, 404 S::CreatedBy: defs_option_state::IsSet, 405 S::LastUpdatedBy: defs_option_state::IsSet, 406{ 407 /// Build the final struct 408 pub fn build(self) -> DefsOption<'a> { 409 DefsOption { 410 created_at: self.__unsafe_private_named.0, 411 created_by: self.__unsafe_private_named.1.unwrap(), 412 description: self.__unsafe_private_named.2, 413 did: self.__unsafe_private_named.3.unwrap(), 414 key: self.__unsafe_private_named.4.unwrap(), 415 last_updated_by: self.__unsafe_private_named.5.unwrap(), 416 manager_role: self.__unsafe_private_named.6, 417 scope: self.__unsafe_private_named.7.unwrap(), 418 updated_at: self.__unsafe_private_named.8, 419 value: self.__unsafe_private_named.9.unwrap(), 420 extra_data: Default::default(), 421 } 422 } 423 /// Build the final struct with custom extra_data 424 pub fn build_with_data( 425 self, 426 extra_data: std::collections::BTreeMap< 427 jacquard_common::smol_str::SmolStr, 428 jacquard_common::types::value::Data<'a>, 429 >, 430 ) -> DefsOption<'a> { 431 DefsOption { 432 created_at: self.__unsafe_private_named.0, 433 created_by: self.__unsafe_private_named.1.unwrap(), 434 description: self.__unsafe_private_named.2, 435 did: self.__unsafe_private_named.3.unwrap(), 436 key: self.__unsafe_private_named.4.unwrap(), 437 last_updated_by: self.__unsafe_private_named.5.unwrap(), 438 manager_role: self.__unsafe_private_named.6, 439 scope: self.__unsafe_private_named.7.unwrap(), 440 updated_at: self.__unsafe_private_named.8, 441 value: self.__unsafe_private_named.9.unwrap(), 442 extra_data: Some(extra_data), 443 } 444 } 445} 446 447fn lexicon_doc_tools_ozone_setting_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 448 'static, 449> { 450 ::jacquard_lexicon::lexicon::LexiconDoc { 451 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 452 id: ::jacquard_common::CowStr::new_static("tools.ozone.setting.defs"), 453 revision: None, 454 description: None, 455 defs: { 456 let mut map = ::std::collections::BTreeMap::new(); 457 map.insert( 458 ::jacquard_common::smol_str::SmolStr::new_static("option"), 459 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 460 description: None, 461 required: Some( 462 vec![ 463 ::jacquard_common::smol_str::SmolStr::new_static("key"), 464 ::jacquard_common::smol_str::SmolStr::new_static("value"), 465 ::jacquard_common::smol_str::SmolStr::new_static("did"), 466 ::jacquard_common::smol_str::SmolStr::new_static("scope"), 467 ::jacquard_common::smol_str::SmolStr::new_static("createdBy"), 468 ::jacquard_common::smol_str::SmolStr::new_static("lastUpdatedBy") 469 ], 470 ), 471 nullable: None, 472 properties: { 473 #[allow(unused_mut)] 474 let mut map = ::std::collections::BTreeMap::new(); 475 map.insert( 476 ::jacquard_common::smol_str::SmolStr::new_static( 477 "createdAt", 478 ), 479 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 480 description: None, 481 format: Some( 482 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 483 ), 484 default: None, 485 min_length: None, 486 max_length: None, 487 min_graphemes: None, 488 max_graphemes: None, 489 r#enum: None, 490 r#const: None, 491 known_values: None, 492 }), 493 ); 494 map.insert( 495 ::jacquard_common::smol_str::SmolStr::new_static( 496 "createdBy", 497 ), 498 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 499 description: None, 500 format: Some( 501 ::jacquard_lexicon::lexicon::LexStringFormat::Did, 502 ), 503 default: None, 504 min_length: None, 505 max_length: None, 506 min_graphemes: None, 507 max_graphemes: None, 508 r#enum: None, 509 r#const: None, 510 known_values: None, 511 }), 512 ); 513 map.insert( 514 ::jacquard_common::smol_str::SmolStr::new_static( 515 "description", 516 ), 517 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 518 description: None, 519 format: None, 520 default: None, 521 min_length: None, 522 max_length: Some(10240usize), 523 min_graphemes: None, 524 max_graphemes: Some(1024usize), 525 r#enum: None, 526 r#const: None, 527 known_values: None, 528 }), 529 ); 530 map.insert( 531 ::jacquard_common::smol_str::SmolStr::new_static("did"), 532 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 533 description: None, 534 format: Some( 535 ::jacquard_lexicon::lexicon::LexStringFormat::Did, 536 ), 537 default: None, 538 min_length: None, 539 max_length: None, 540 min_graphemes: None, 541 max_graphemes: None, 542 r#enum: None, 543 r#const: None, 544 known_values: None, 545 }), 546 ); 547 map.insert( 548 ::jacquard_common::smol_str::SmolStr::new_static("key"), 549 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 550 description: None, 551 format: Some( 552 ::jacquard_lexicon::lexicon::LexStringFormat::Nsid, 553 ), 554 default: None, 555 min_length: None, 556 max_length: None, 557 min_graphemes: None, 558 max_graphemes: None, 559 r#enum: None, 560 r#const: None, 561 known_values: None, 562 }), 563 ); 564 map.insert( 565 ::jacquard_common::smol_str::SmolStr::new_static( 566 "lastUpdatedBy", 567 ), 568 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 569 description: None, 570 format: Some( 571 ::jacquard_lexicon::lexicon::LexStringFormat::Did, 572 ), 573 default: None, 574 min_length: None, 575 max_length: None, 576 min_graphemes: None, 577 max_graphemes: None, 578 r#enum: None, 579 r#const: None, 580 known_values: None, 581 }), 582 ); 583 map.insert( 584 ::jacquard_common::smol_str::SmolStr::new_static( 585 "managerRole", 586 ), 587 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 588 description: None, 589 format: None, 590 default: None, 591 min_length: None, 592 max_length: None, 593 min_graphemes: None, 594 max_graphemes: None, 595 r#enum: None, 596 r#const: None, 597 known_values: None, 598 }), 599 ); 600 map.insert( 601 ::jacquard_common::smol_str::SmolStr::new_static("scope"), 602 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 603 description: None, 604 format: None, 605 default: None, 606 min_length: None, 607 max_length: None, 608 min_graphemes: None, 609 max_graphemes: None, 610 r#enum: None, 611 r#const: None, 612 known_values: None, 613 }), 614 ); 615 map.insert( 616 ::jacquard_common::smol_str::SmolStr::new_static( 617 "updatedAt", 618 ), 619 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 620 description: None, 621 format: Some( 622 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 623 ), 624 default: None, 625 min_length: None, 626 max_length: None, 627 min_graphemes: None, 628 max_graphemes: None, 629 r#enum: None, 630 r#const: None, 631 known_values: None, 632 }), 633 ); 634 map.insert( 635 ::jacquard_common::smol_str::SmolStr::new_static("value"), 636 ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { 637 description: None, 638 }), 639 ); 640 map 641 }, 642 }), 643 ); 644 map 645 }, 646 } 647} 648 649impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DefsOption<'a> { 650 fn nsid() -> &'static str { 651 "tools.ozone.setting.defs" 652 } 653 fn def_name() -> &'static str { 654 "option" 655 } 656 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 657 lexicon_doc_tools_ozone_setting_defs() 658 } 659 fn validate( 660 &self, 661 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 662 if let Some(ref value) = self.description { 663 #[allow(unused_comparisons)] 664 if <str>::len(value.as_ref()) > 10240usize { 665 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 666 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 667 "description", 668 ), 669 max: 10240usize, 670 actual: <str>::len(value.as_ref()), 671 }); 672 } 673 } 674 if let Some(ref value) = self.description { 675 { 676 let count = ::unicode_segmentation::UnicodeSegmentation::graphemes( 677 value.as_ref(), 678 true, 679 ) 680 .count(); 681 if count > 1024usize { 682 return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 683 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 684 "description", 685 ), 686 max: 1024usize, 687 actual: count, 688 }); 689 } 690 } 691 } 692 Ok(()) 693 } 694}