atproto blogging
at main 1301 lines 45 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: pub.leaflet.richtext.facet 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// Facet feature for mentioning an AT URI. 9#[jacquard_derive::lexicon] 10#[derive( 11 serde::Serialize, 12 serde::Deserialize, 13 Debug, 14 Clone, 15 PartialEq, 16 Eq, 17 jacquard_derive::IntoStatic 18)] 19#[serde(rename_all = "camelCase")] 20pub struct AtMention<'a> { 21 #[serde(borrow)] 22 pub at_uri: jacquard_common::types::string::Uri<'a>, 23} 24 25pub mod at_mention_state { 26 27 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 28 #[allow(unused)] 29 use ::core::marker::PhantomData; 30 mod sealed { 31 pub trait Sealed {} 32 } 33 /// State trait tracking which required fields have been set 34 pub trait State: sealed::Sealed { 35 type AtUri; 36 } 37 /// Empty state - all required fields are unset 38 pub struct Empty(()); 39 impl sealed::Sealed for Empty {} 40 impl State for Empty { 41 type AtUri = Unset; 42 } 43 ///State transition - sets the `at_uri` field to Set 44 pub struct SetAtUri<S: State = Empty>(PhantomData<fn() -> S>); 45 impl<S: State> sealed::Sealed for SetAtUri<S> {} 46 impl<S: State> State for SetAtUri<S> { 47 type AtUri = Set<members::at_uri>; 48 } 49 /// Marker types for field names 50 #[allow(non_camel_case_types)] 51 pub mod members { 52 ///Marker type for the `at_uri` field 53 pub struct at_uri(()); 54 } 55} 56 57/// Builder for constructing an instance of this type 58pub struct AtMentionBuilder<'a, S: at_mention_state::State> { 59 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 60 __unsafe_private_named: ( 61 ::core::option::Option<jacquard_common::types::string::Uri<'a>>, 62 ), 63 _phantom: ::core::marker::PhantomData<&'a ()>, 64} 65 66impl<'a> AtMention<'a> { 67 /// Create a new builder for this type 68 pub fn new() -> AtMentionBuilder<'a, at_mention_state::Empty> { 69 AtMentionBuilder::new() 70 } 71} 72 73impl<'a> AtMentionBuilder<'a, at_mention_state::Empty> { 74 /// Create a new builder with all fields unset 75 pub fn new() -> Self { 76 AtMentionBuilder { 77 _phantom_state: ::core::marker::PhantomData, 78 __unsafe_private_named: (None,), 79 _phantom: ::core::marker::PhantomData, 80 } 81 } 82} 83 84impl<'a, S> AtMentionBuilder<'a, S> 85where 86 S: at_mention_state::State, 87 S::AtUri: at_mention_state::IsUnset, 88{ 89 /// Set the `atURI` field (required) 90 pub fn at_uri( 91 mut self, 92 value: impl Into<jacquard_common::types::string::Uri<'a>>, 93 ) -> AtMentionBuilder<'a, at_mention_state::SetAtUri<S>> { 94 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 95 AtMentionBuilder { 96 _phantom_state: ::core::marker::PhantomData, 97 __unsafe_private_named: self.__unsafe_private_named, 98 _phantom: ::core::marker::PhantomData, 99 } 100 } 101} 102 103impl<'a, S> AtMentionBuilder<'a, S> 104where 105 S: at_mention_state::State, 106 S::AtUri: at_mention_state::IsSet, 107{ 108 /// Build the final struct 109 pub fn build(self) -> AtMention<'a> { 110 AtMention { 111 at_uri: self.__unsafe_private_named.0.unwrap(), 112 extra_data: Default::default(), 113 } 114 } 115 /// Build the final struct with custom extra_data 116 pub fn build_with_data( 117 self, 118 extra_data: std::collections::BTreeMap< 119 jacquard_common::smol_str::SmolStr, 120 jacquard_common::types::value::Data<'a>, 121 >, 122 ) -> AtMention<'a> { 123 AtMention { 124 at_uri: self.__unsafe_private_named.0.unwrap(), 125 extra_data: Some(extra_data), 126 } 127 } 128} 129 130fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::LexiconDoc< 131 'static, 132> { 133 ::jacquard_lexicon::lexicon::LexiconDoc { 134 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 135 id: ::jacquard_common::CowStr::new_static("pub.leaflet.richtext.facet"), 136 revision: None, 137 description: None, 138 defs: { 139 let mut map = ::alloc::collections::BTreeMap::new(); 140 map.insert( 141 ::jacquard_common::smol_str::SmolStr::new_static("atMention"), 142 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 143 description: Some( 144 ::jacquard_common::CowStr::new_static( 145 "Facet feature for mentioning an AT URI.", 146 ), 147 ), 148 required: Some( 149 vec![::jacquard_common::smol_str::SmolStr::new_static("atURI")], 150 ), 151 nullable: None, 152 properties: { 153 #[allow(unused_mut)] 154 let mut map = ::alloc::collections::BTreeMap::new(); 155 map.insert( 156 ::jacquard_common::smol_str::SmolStr::new_static("atURI"), 157 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 158 description: None, 159 format: Some( 160 ::jacquard_lexicon::lexicon::LexStringFormat::Uri, 161 ), 162 default: None, 163 min_length: None, 164 max_length: None, 165 min_graphemes: None, 166 max_graphemes: None, 167 r#enum: None, 168 r#const: None, 169 known_values: None, 170 }), 171 ); 172 map 173 }, 174 }), 175 ); 176 map.insert( 177 ::jacquard_common::smol_str::SmolStr::new_static("bold"), 178 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 179 description: Some( 180 ::jacquard_common::CowStr::new_static( 181 "Facet feature for bold text", 182 ), 183 ), 184 required: Some(vec![]), 185 nullable: None, 186 properties: { 187 #[allow(unused_mut)] 188 let mut map = ::alloc::collections::BTreeMap::new(); 189 map 190 }, 191 }), 192 ); 193 map.insert( 194 ::jacquard_common::smol_str::SmolStr::new_static("byteSlice"), 195 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 196 description: Some( 197 ::jacquard_common::CowStr::new_static( 198 "Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.", 199 ), 200 ), 201 required: Some( 202 vec![ 203 ::jacquard_common::smol_str::SmolStr::new_static("byteStart"), 204 ::jacquard_common::smol_str::SmolStr::new_static("byteEnd") 205 ], 206 ), 207 nullable: None, 208 properties: { 209 #[allow(unused_mut)] 210 let mut map = ::alloc::collections::BTreeMap::new(); 211 map.insert( 212 ::jacquard_common::smol_str::SmolStr::new_static("byteEnd"), 213 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 214 description: None, 215 default: None, 216 minimum: Some(0i64), 217 maximum: None, 218 r#enum: None, 219 r#const: None, 220 }), 221 ); 222 map.insert( 223 ::jacquard_common::smol_str::SmolStr::new_static( 224 "byteStart", 225 ), 226 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 227 description: None, 228 default: None, 229 minimum: Some(0i64), 230 maximum: None, 231 r#enum: None, 232 r#const: None, 233 }), 234 ); 235 map 236 }, 237 }), 238 ); 239 map.insert( 240 ::jacquard_common::smol_str::SmolStr::new_static("code"), 241 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 242 description: Some( 243 ::jacquard_common::CowStr::new_static( 244 "Facet feature for inline code.", 245 ), 246 ), 247 required: Some(vec![]), 248 nullable: None, 249 properties: { 250 #[allow(unused_mut)] 251 let mut map = ::alloc::collections::BTreeMap::new(); 252 map 253 }, 254 }), 255 ); 256 map.insert( 257 ::jacquard_common::smol_str::SmolStr::new_static("didMention"), 258 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 259 description: Some( 260 ::jacquard_common::CowStr::new_static( 261 "Facet feature for mentioning a did.", 262 ), 263 ), 264 required: Some( 265 vec![::jacquard_common::smol_str::SmolStr::new_static("did")], 266 ), 267 nullable: None, 268 properties: { 269 #[allow(unused_mut)] 270 let mut map = ::alloc::collections::BTreeMap::new(); 271 map.insert( 272 ::jacquard_common::smol_str::SmolStr::new_static("did"), 273 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 274 description: None, 275 format: Some( 276 ::jacquard_lexicon::lexicon::LexStringFormat::Did, 277 ), 278 default: None, 279 min_length: None, 280 max_length: None, 281 min_graphemes: None, 282 max_graphemes: None, 283 r#enum: None, 284 r#const: None, 285 known_values: None, 286 }), 287 ); 288 map 289 }, 290 }), 291 ); 292 map.insert( 293 ::jacquard_common::smol_str::SmolStr::new_static("highlight"), 294 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 295 description: Some( 296 ::jacquard_common::CowStr::new_static( 297 "Facet feature for highlighted text.", 298 ), 299 ), 300 required: Some(vec![]), 301 nullable: None, 302 properties: { 303 #[allow(unused_mut)] 304 let mut map = ::alloc::collections::BTreeMap::new(); 305 map 306 }, 307 }), 308 ); 309 map.insert( 310 ::jacquard_common::smol_str::SmolStr::new_static("id"), 311 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 312 description: Some( 313 ::jacquard_common::CowStr::new_static( 314 "Facet feature for an identifier. Used for linking to a segment", 315 ), 316 ), 317 required: Some(vec![]), 318 nullable: None, 319 properties: { 320 #[allow(unused_mut)] 321 let mut map = ::alloc::collections::BTreeMap::new(); 322 map.insert( 323 ::jacquard_common::smol_str::SmolStr::new_static("id"), 324 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 325 description: None, 326 format: None, 327 default: None, 328 min_length: None, 329 max_length: None, 330 min_graphemes: None, 331 max_graphemes: None, 332 r#enum: None, 333 r#const: None, 334 known_values: None, 335 }), 336 ); 337 map 338 }, 339 }), 340 ); 341 map.insert( 342 ::jacquard_common::smol_str::SmolStr::new_static("italic"), 343 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 344 description: Some( 345 ::jacquard_common::CowStr::new_static( 346 "Facet feature for italic text", 347 ), 348 ), 349 required: Some(vec![]), 350 nullable: None, 351 properties: { 352 #[allow(unused_mut)] 353 let mut map = ::alloc::collections::BTreeMap::new(); 354 map 355 }, 356 }), 357 ); 358 map.insert( 359 ::jacquard_common::smol_str::SmolStr::new_static("link"), 360 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 361 description: Some( 362 ::jacquard_common::CowStr::new_static( 363 "Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.", 364 ), 365 ), 366 required: Some( 367 vec![::jacquard_common::smol_str::SmolStr::new_static("uri")], 368 ), 369 nullable: None, 370 properties: { 371 #[allow(unused_mut)] 372 let mut map = ::alloc::collections::BTreeMap::new(); 373 map.insert( 374 ::jacquard_common::smol_str::SmolStr::new_static("uri"), 375 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 376 description: None, 377 format: None, 378 default: None, 379 min_length: None, 380 max_length: None, 381 min_graphemes: None, 382 max_graphemes: None, 383 r#enum: None, 384 r#const: None, 385 known_values: None, 386 }), 387 ); 388 map 389 }, 390 }), 391 ); 392 map.insert( 393 ::jacquard_common::smol_str::SmolStr::new_static("main"), 394 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 395 description: Some( 396 ::jacquard_common::CowStr::new_static( 397 "Annotation of a sub-string within rich text.", 398 ), 399 ), 400 required: Some( 401 vec![ 402 ::jacquard_common::smol_str::SmolStr::new_static("index"), 403 ::jacquard_common::smol_str::SmolStr::new_static("features") 404 ], 405 ), 406 nullable: None, 407 properties: { 408 #[allow(unused_mut)] 409 let mut map = ::alloc::collections::BTreeMap::new(); 410 map.insert( 411 ::jacquard_common::smol_str::SmolStr::new_static("features"), 412 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 413 description: None, 414 items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion { 415 description: None, 416 refs: vec![ 417 ::jacquard_common::CowStr::new_static("#link"), 418 ::jacquard_common::CowStr::new_static("#didMention"), 419 ::jacquard_common::CowStr::new_static("#atMention"), 420 ::jacquard_common::CowStr::new_static("#code"), 421 ::jacquard_common::CowStr::new_static("#highlight"), 422 ::jacquard_common::CowStr::new_static("#underline"), 423 ::jacquard_common::CowStr::new_static("#strikethrough"), 424 ::jacquard_common::CowStr::new_static("#id"), 425 ::jacquard_common::CowStr::new_static("#bold"), 426 ::jacquard_common::CowStr::new_static("#italic") 427 ], 428 closed: None, 429 }), 430 min_length: None, 431 max_length: None, 432 }), 433 ); 434 map.insert( 435 ::jacquard_common::smol_str::SmolStr::new_static("index"), 436 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 437 description: None, 438 r#ref: ::jacquard_common::CowStr::new_static("#byteSlice"), 439 }), 440 ); 441 map 442 }, 443 }), 444 ); 445 map.insert( 446 ::jacquard_common::smol_str::SmolStr::new_static("strikethrough"), 447 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 448 description: Some( 449 ::jacquard_common::CowStr::new_static( 450 "Facet feature for strikethrough markup", 451 ), 452 ), 453 required: Some(vec![]), 454 nullable: None, 455 properties: { 456 #[allow(unused_mut)] 457 let mut map = ::alloc::collections::BTreeMap::new(); 458 map 459 }, 460 }), 461 ); 462 map.insert( 463 ::jacquard_common::smol_str::SmolStr::new_static("underline"), 464 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 465 description: Some( 466 ::jacquard_common::CowStr::new_static( 467 "Facet feature for underline markup", 468 ), 469 ), 470 required: Some(vec![]), 471 nullable: None, 472 properties: { 473 #[allow(unused_mut)] 474 let mut map = ::alloc::collections::BTreeMap::new(); 475 map 476 }, 477 }), 478 ); 479 map 480 }, 481 } 482} 483 484impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AtMention<'a> { 485 fn nsid() -> &'static str { 486 "pub.leaflet.richtext.facet" 487 } 488 fn def_name() -> &'static str { 489 "atMention" 490 } 491 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 492 lexicon_doc_pub_leaflet_richtext_facet() 493 } 494 fn validate( 495 &self, 496 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 497 Ok(()) 498 } 499} 500 501/// Facet feature for bold text 502#[jacquard_derive::lexicon] 503#[derive( 504 serde::Serialize, 505 serde::Deserialize, 506 Debug, 507 Clone, 508 PartialEq, 509 Eq, 510 jacquard_derive::IntoStatic, 511 Default 512)] 513#[serde(rename_all = "camelCase")] 514pub struct Bold<'a> {} 515impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Bold<'a> { 516 fn nsid() -> &'static str { 517 "pub.leaflet.richtext.facet" 518 } 519 fn def_name() -> &'static str { 520 "bold" 521 } 522 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 523 lexicon_doc_pub_leaflet_richtext_facet() 524 } 525 fn validate( 526 &self, 527 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 528 Ok(()) 529 } 530} 531 532/// Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. 533#[jacquard_derive::lexicon] 534#[derive( 535 serde::Serialize, 536 serde::Deserialize, 537 Debug, 538 Clone, 539 PartialEq, 540 Eq, 541 jacquard_derive::IntoStatic 542)] 543#[serde(rename_all = "camelCase")] 544pub struct ByteSlice<'a> { 545 pub byte_end: i64, 546 pub byte_start: i64, 547} 548 549pub mod byte_slice_state { 550 551 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 552 #[allow(unused)] 553 use ::core::marker::PhantomData; 554 mod sealed { 555 pub trait Sealed {} 556 } 557 /// State trait tracking which required fields have been set 558 pub trait State: sealed::Sealed { 559 type ByteEnd; 560 type ByteStart; 561 } 562 /// Empty state - all required fields are unset 563 pub struct Empty(()); 564 impl sealed::Sealed for Empty {} 565 impl State for Empty { 566 type ByteEnd = Unset; 567 type ByteStart = Unset; 568 } 569 ///State transition - sets the `byte_end` field to Set 570 pub struct SetByteEnd<S: State = Empty>(PhantomData<fn() -> S>); 571 impl<S: State> sealed::Sealed for SetByteEnd<S> {} 572 impl<S: State> State for SetByteEnd<S> { 573 type ByteEnd = Set<members::byte_end>; 574 type ByteStart = S::ByteStart; 575 } 576 ///State transition - sets the `byte_start` field to Set 577 pub struct SetByteStart<S: State = Empty>(PhantomData<fn() -> S>); 578 impl<S: State> sealed::Sealed for SetByteStart<S> {} 579 impl<S: State> State for SetByteStart<S> { 580 type ByteEnd = S::ByteEnd; 581 type ByteStart = Set<members::byte_start>; 582 } 583 /// Marker types for field names 584 #[allow(non_camel_case_types)] 585 pub mod members { 586 ///Marker type for the `byte_end` field 587 pub struct byte_end(()); 588 ///Marker type for the `byte_start` field 589 pub struct byte_start(()); 590 } 591} 592 593/// Builder for constructing an instance of this type 594pub struct ByteSliceBuilder<'a, S: byte_slice_state::State> { 595 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 596 __unsafe_private_named: (::core::option::Option<i64>, ::core::option::Option<i64>), 597 _phantom: ::core::marker::PhantomData<&'a ()>, 598} 599 600impl<'a> ByteSlice<'a> { 601 /// Create a new builder for this type 602 pub fn new() -> ByteSliceBuilder<'a, byte_slice_state::Empty> { 603 ByteSliceBuilder::new() 604 } 605} 606 607impl<'a> ByteSliceBuilder<'a, byte_slice_state::Empty> { 608 /// Create a new builder with all fields unset 609 pub fn new() -> Self { 610 ByteSliceBuilder { 611 _phantom_state: ::core::marker::PhantomData, 612 __unsafe_private_named: (None, None), 613 _phantom: ::core::marker::PhantomData, 614 } 615 } 616} 617 618impl<'a, S> ByteSliceBuilder<'a, S> 619where 620 S: byte_slice_state::State, 621 S::ByteEnd: byte_slice_state::IsUnset, 622{ 623 /// Set the `byteEnd` field (required) 624 pub fn byte_end( 625 mut self, 626 value: impl Into<i64>, 627 ) -> ByteSliceBuilder<'a, byte_slice_state::SetByteEnd<S>> { 628 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 629 ByteSliceBuilder { 630 _phantom_state: ::core::marker::PhantomData, 631 __unsafe_private_named: self.__unsafe_private_named, 632 _phantom: ::core::marker::PhantomData, 633 } 634 } 635} 636 637impl<'a, S> ByteSliceBuilder<'a, S> 638where 639 S: byte_slice_state::State, 640 S::ByteStart: byte_slice_state::IsUnset, 641{ 642 /// Set the `byteStart` field (required) 643 pub fn byte_start( 644 mut self, 645 value: impl Into<i64>, 646 ) -> ByteSliceBuilder<'a, byte_slice_state::SetByteStart<S>> { 647 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 648 ByteSliceBuilder { 649 _phantom_state: ::core::marker::PhantomData, 650 __unsafe_private_named: self.__unsafe_private_named, 651 _phantom: ::core::marker::PhantomData, 652 } 653 } 654} 655 656impl<'a, S> ByteSliceBuilder<'a, S> 657where 658 S: byte_slice_state::State, 659 S::ByteEnd: byte_slice_state::IsSet, 660 S::ByteStart: byte_slice_state::IsSet, 661{ 662 /// Build the final struct 663 pub fn build(self) -> ByteSlice<'a> { 664 ByteSlice { 665 byte_end: self.__unsafe_private_named.0.unwrap(), 666 byte_start: self.__unsafe_private_named.1.unwrap(), 667 extra_data: Default::default(), 668 } 669 } 670 /// Build the final struct with custom extra_data 671 pub fn build_with_data( 672 self, 673 extra_data: std::collections::BTreeMap< 674 jacquard_common::smol_str::SmolStr, 675 jacquard_common::types::value::Data<'a>, 676 >, 677 ) -> ByteSlice<'a> { 678 ByteSlice { 679 byte_end: self.__unsafe_private_named.0.unwrap(), 680 byte_start: self.__unsafe_private_named.1.unwrap(), 681 extra_data: Some(extra_data), 682 } 683 } 684} 685 686impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ByteSlice<'a> { 687 fn nsid() -> &'static str { 688 "pub.leaflet.richtext.facet" 689 } 690 fn def_name() -> &'static str { 691 "byteSlice" 692 } 693 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 694 lexicon_doc_pub_leaflet_richtext_facet() 695 } 696 fn validate( 697 &self, 698 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 699 { 700 let value = &self.byte_end; 701 if *value < 0i64 { 702 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 703 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 704 "byte_end", 705 ), 706 min: 0i64, 707 actual: *value, 708 }); 709 } 710 } 711 { 712 let value = &self.byte_start; 713 if *value < 0i64 { 714 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 715 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 716 "byte_start", 717 ), 718 min: 0i64, 719 actual: *value, 720 }); 721 } 722 } 723 Ok(()) 724 } 725} 726 727/// Facet feature for inline code. 728#[jacquard_derive::lexicon] 729#[derive( 730 serde::Serialize, 731 serde::Deserialize, 732 Debug, 733 Clone, 734 PartialEq, 735 Eq, 736 jacquard_derive::IntoStatic, 737 Default 738)] 739#[serde(rename_all = "camelCase")] 740pub struct Code<'a> {} 741impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Code<'a> { 742 fn nsid() -> &'static str { 743 "pub.leaflet.richtext.facet" 744 } 745 fn def_name() -> &'static str { 746 "code" 747 } 748 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 749 lexicon_doc_pub_leaflet_richtext_facet() 750 } 751 fn validate( 752 &self, 753 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 754 Ok(()) 755 } 756} 757 758/// Facet feature for mentioning a did. 759#[jacquard_derive::lexicon] 760#[derive( 761 serde::Serialize, 762 serde::Deserialize, 763 Debug, 764 Clone, 765 PartialEq, 766 Eq, 767 jacquard_derive::IntoStatic 768)] 769#[serde(rename_all = "camelCase")] 770pub struct DidMention<'a> { 771 #[serde(borrow)] 772 pub did: jacquard_common::types::string::Did<'a>, 773} 774 775pub mod did_mention_state { 776 777 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 778 #[allow(unused)] 779 use ::core::marker::PhantomData; 780 mod sealed { 781 pub trait Sealed {} 782 } 783 /// State trait tracking which required fields have been set 784 pub trait State: sealed::Sealed { 785 type Did; 786 } 787 /// Empty state - all required fields are unset 788 pub struct Empty(()); 789 impl sealed::Sealed for Empty {} 790 impl State for Empty { 791 type Did = Unset; 792 } 793 ///State transition - sets the `did` field to Set 794 pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>); 795 impl<S: State> sealed::Sealed for SetDid<S> {} 796 impl<S: State> State for SetDid<S> { 797 type Did = Set<members::did>; 798 } 799 /// Marker types for field names 800 #[allow(non_camel_case_types)] 801 pub mod members { 802 ///Marker type for the `did` field 803 pub struct did(()); 804 } 805} 806 807/// Builder for constructing an instance of this type 808pub struct DidMentionBuilder<'a, S: did_mention_state::State> { 809 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 810 __unsafe_private_named: ( 811 ::core::option::Option<jacquard_common::types::string::Did<'a>>, 812 ), 813 _phantom: ::core::marker::PhantomData<&'a ()>, 814} 815 816impl<'a> DidMention<'a> { 817 /// Create a new builder for this type 818 pub fn new() -> DidMentionBuilder<'a, did_mention_state::Empty> { 819 DidMentionBuilder::new() 820 } 821} 822 823impl<'a> DidMentionBuilder<'a, did_mention_state::Empty> { 824 /// Create a new builder with all fields unset 825 pub fn new() -> Self { 826 DidMentionBuilder { 827 _phantom_state: ::core::marker::PhantomData, 828 __unsafe_private_named: (None,), 829 _phantom: ::core::marker::PhantomData, 830 } 831 } 832} 833 834impl<'a, S> DidMentionBuilder<'a, S> 835where 836 S: did_mention_state::State, 837 S::Did: did_mention_state::IsUnset, 838{ 839 /// Set the `did` field (required) 840 pub fn did( 841 mut self, 842 value: impl Into<jacquard_common::types::string::Did<'a>>, 843 ) -> DidMentionBuilder<'a, did_mention_state::SetDid<S>> { 844 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 845 DidMentionBuilder { 846 _phantom_state: ::core::marker::PhantomData, 847 __unsafe_private_named: self.__unsafe_private_named, 848 _phantom: ::core::marker::PhantomData, 849 } 850 } 851} 852 853impl<'a, S> DidMentionBuilder<'a, S> 854where 855 S: did_mention_state::State, 856 S::Did: did_mention_state::IsSet, 857{ 858 /// Build the final struct 859 pub fn build(self) -> DidMention<'a> { 860 DidMention { 861 did: self.__unsafe_private_named.0.unwrap(), 862 extra_data: Default::default(), 863 } 864 } 865 /// Build the final struct with custom extra_data 866 pub fn build_with_data( 867 self, 868 extra_data: std::collections::BTreeMap< 869 jacquard_common::smol_str::SmolStr, 870 jacquard_common::types::value::Data<'a>, 871 >, 872 ) -> DidMention<'a> { 873 DidMention { 874 did: self.__unsafe_private_named.0.unwrap(), 875 extra_data: Some(extra_data), 876 } 877 } 878} 879 880impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DidMention<'a> { 881 fn nsid() -> &'static str { 882 "pub.leaflet.richtext.facet" 883 } 884 fn def_name() -> &'static str { 885 "didMention" 886 } 887 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 888 lexicon_doc_pub_leaflet_richtext_facet() 889 } 890 fn validate( 891 &self, 892 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 893 Ok(()) 894 } 895} 896 897/// Facet feature for highlighted text. 898#[jacquard_derive::lexicon] 899#[derive( 900 serde::Serialize, 901 serde::Deserialize, 902 Debug, 903 Clone, 904 PartialEq, 905 Eq, 906 jacquard_derive::IntoStatic, 907 Default 908)] 909#[serde(rename_all = "camelCase")] 910pub struct Highlight<'a> {} 911impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Highlight<'a> { 912 fn nsid() -> &'static str { 913 "pub.leaflet.richtext.facet" 914 } 915 fn def_name() -> &'static str { 916 "highlight" 917 } 918 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 919 lexicon_doc_pub_leaflet_richtext_facet() 920 } 921 fn validate( 922 &self, 923 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 924 Ok(()) 925 } 926} 927 928/// Facet feature for an identifier. Used for linking to a segment 929#[jacquard_derive::lexicon] 930#[derive( 931 serde::Serialize, 932 serde::Deserialize, 933 Debug, 934 Clone, 935 PartialEq, 936 Eq, 937 jacquard_derive::IntoStatic, 938 Default 939)] 940#[serde(rename_all = "camelCase")] 941pub struct Id<'a> { 942 #[serde(skip_serializing_if = "std::option::Option::is_none")] 943 #[serde(borrow)] 944 pub id: std::option::Option<jacquard_common::CowStr<'a>>, 945} 946 947impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Id<'a> { 948 fn nsid() -> &'static str { 949 "pub.leaflet.richtext.facet" 950 } 951 fn def_name() -> &'static str { 952 "id" 953 } 954 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 955 lexicon_doc_pub_leaflet_richtext_facet() 956 } 957 fn validate( 958 &self, 959 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 960 Ok(()) 961 } 962} 963 964/// Facet feature for italic text 965#[jacquard_derive::lexicon] 966#[derive( 967 serde::Serialize, 968 serde::Deserialize, 969 Debug, 970 Clone, 971 PartialEq, 972 Eq, 973 jacquard_derive::IntoStatic, 974 Default 975)] 976#[serde(rename_all = "camelCase")] 977pub struct Italic<'a> {} 978impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Italic<'a> { 979 fn nsid() -> &'static str { 980 "pub.leaflet.richtext.facet" 981 } 982 fn def_name() -> &'static str { 983 "italic" 984 } 985 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 986 lexicon_doc_pub_leaflet_richtext_facet() 987 } 988 fn validate( 989 &self, 990 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 991 Ok(()) 992 } 993} 994 995/// Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. 996#[jacquard_derive::lexicon] 997#[derive( 998 serde::Serialize, 999 serde::Deserialize, 1000 Debug, 1001 Clone, 1002 PartialEq, 1003 Eq, 1004 jacquard_derive::IntoStatic, 1005 Default 1006)] 1007#[serde(rename_all = "camelCase")] 1008pub struct Link<'a> { 1009 #[serde(borrow)] 1010 pub uri: jacquard_common::CowStr<'a>, 1011} 1012 1013impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Link<'a> { 1014 fn nsid() -> &'static str { 1015 "pub.leaflet.richtext.facet" 1016 } 1017 fn def_name() -> &'static str { 1018 "link" 1019 } 1020 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1021 lexicon_doc_pub_leaflet_richtext_facet() 1022 } 1023 fn validate( 1024 &self, 1025 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1026 Ok(()) 1027 } 1028} 1029 1030/// Annotation of a sub-string within rich text. 1031#[jacquard_derive::lexicon] 1032#[derive( 1033 serde::Serialize, 1034 serde::Deserialize, 1035 Debug, 1036 Clone, 1037 PartialEq, 1038 Eq, 1039 jacquard_derive::IntoStatic 1040)] 1041#[serde(rename_all = "camelCase")] 1042pub struct Facet<'a> { 1043 #[serde(borrow)] 1044 pub features: Vec<FacetFeaturesItem<'a>>, 1045 #[serde(borrow)] 1046 pub index: crate::pub_leaflet::richtext::facet::ByteSlice<'a>, 1047} 1048 1049pub mod facet_state { 1050 1051 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1052 #[allow(unused)] 1053 use ::core::marker::PhantomData; 1054 mod sealed { 1055 pub trait Sealed {} 1056 } 1057 /// State trait tracking which required fields have been set 1058 pub trait State: sealed::Sealed { 1059 type Features; 1060 type Index; 1061 } 1062 /// Empty state - all required fields are unset 1063 pub struct Empty(()); 1064 impl sealed::Sealed for Empty {} 1065 impl State for Empty { 1066 type Features = Unset; 1067 type Index = Unset; 1068 } 1069 ///State transition - sets the `features` field to Set 1070 pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>); 1071 impl<S: State> sealed::Sealed for SetFeatures<S> {} 1072 impl<S: State> State for SetFeatures<S> { 1073 type Features = Set<members::features>; 1074 type Index = S::Index; 1075 } 1076 ///State transition - sets the `index` field to Set 1077 pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>); 1078 impl<S: State> sealed::Sealed for SetIndex<S> {} 1079 impl<S: State> State for SetIndex<S> { 1080 type Features = S::Features; 1081 type Index = Set<members::index>; 1082 } 1083 /// Marker types for field names 1084 #[allow(non_camel_case_types)] 1085 pub mod members { 1086 ///Marker type for the `features` field 1087 pub struct features(()); 1088 ///Marker type for the `index` field 1089 pub struct index(()); 1090 } 1091} 1092 1093/// Builder for constructing an instance of this type 1094pub struct FacetBuilder<'a, S: facet_state::State> { 1095 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1096 __unsafe_private_named: ( 1097 ::core::option::Option<Vec<FacetFeaturesItem<'a>>>, 1098 ::core::option::Option<crate::pub_leaflet::richtext::facet::ByteSlice<'a>>, 1099 ), 1100 _phantom: ::core::marker::PhantomData<&'a ()>, 1101} 1102 1103impl<'a> Facet<'a> { 1104 /// Create a new builder for this type 1105 pub fn new() -> FacetBuilder<'a, facet_state::Empty> { 1106 FacetBuilder::new() 1107 } 1108} 1109 1110impl<'a> FacetBuilder<'a, facet_state::Empty> { 1111 /// Create a new builder with all fields unset 1112 pub fn new() -> Self { 1113 FacetBuilder { 1114 _phantom_state: ::core::marker::PhantomData, 1115 __unsafe_private_named: (None, None), 1116 _phantom: ::core::marker::PhantomData, 1117 } 1118 } 1119} 1120 1121impl<'a, S> FacetBuilder<'a, S> 1122where 1123 S: facet_state::State, 1124 S::Features: facet_state::IsUnset, 1125{ 1126 /// Set the `features` field (required) 1127 pub fn features( 1128 mut self, 1129 value: impl Into<Vec<FacetFeaturesItem<'a>>>, 1130 ) -> FacetBuilder<'a, facet_state::SetFeatures<S>> { 1131 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1132 FacetBuilder { 1133 _phantom_state: ::core::marker::PhantomData, 1134 __unsafe_private_named: self.__unsafe_private_named, 1135 _phantom: ::core::marker::PhantomData, 1136 } 1137 } 1138} 1139 1140impl<'a, S> FacetBuilder<'a, S> 1141where 1142 S: facet_state::State, 1143 S::Index: facet_state::IsUnset, 1144{ 1145 /// Set the `index` field (required) 1146 pub fn index( 1147 mut self, 1148 value: impl Into<crate::pub_leaflet::richtext::facet::ByteSlice<'a>>, 1149 ) -> FacetBuilder<'a, facet_state::SetIndex<S>> { 1150 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1151 FacetBuilder { 1152 _phantom_state: ::core::marker::PhantomData, 1153 __unsafe_private_named: self.__unsafe_private_named, 1154 _phantom: ::core::marker::PhantomData, 1155 } 1156 } 1157} 1158 1159impl<'a, S> FacetBuilder<'a, S> 1160where 1161 S: facet_state::State, 1162 S::Features: facet_state::IsSet, 1163 S::Index: facet_state::IsSet, 1164{ 1165 /// Build the final struct 1166 pub fn build(self) -> Facet<'a> { 1167 Facet { 1168 features: self.__unsafe_private_named.0.unwrap(), 1169 index: self.__unsafe_private_named.1.unwrap(), 1170 extra_data: Default::default(), 1171 } 1172 } 1173 /// Build the final struct with custom extra_data 1174 pub fn build_with_data( 1175 self, 1176 extra_data: std::collections::BTreeMap< 1177 jacquard_common::smol_str::SmolStr, 1178 jacquard_common::types::value::Data<'a>, 1179 >, 1180 ) -> Facet<'a> { 1181 Facet { 1182 features: self.__unsafe_private_named.0.unwrap(), 1183 index: self.__unsafe_private_named.1.unwrap(), 1184 extra_data: Some(extra_data), 1185 } 1186 } 1187} 1188 1189#[jacquard_derive::open_union] 1190#[derive( 1191 serde::Serialize, 1192 serde::Deserialize, 1193 Debug, 1194 Clone, 1195 PartialEq, 1196 Eq, 1197 jacquard_derive::IntoStatic 1198)] 1199#[serde(tag = "$type")] 1200#[serde(bound(deserialize = "'de: 'a"))] 1201pub enum FacetFeaturesItem<'a> { 1202 #[serde(rename = "pub.leaflet.richtext.facet#link")] 1203 Link(Box<crate::pub_leaflet::richtext::facet::Link<'a>>), 1204 #[serde(rename = "pub.leaflet.richtext.facet#didMention")] 1205 DidMention(Box<crate::pub_leaflet::richtext::facet::DidMention<'a>>), 1206 #[serde(rename = "pub.leaflet.richtext.facet#atMention")] 1207 AtMention(Box<crate::pub_leaflet::richtext::facet::AtMention<'a>>), 1208 #[serde(rename = "pub.leaflet.richtext.facet#code")] 1209 Code(Box<crate::pub_leaflet::richtext::facet::Code<'a>>), 1210 #[serde(rename = "pub.leaflet.richtext.facet#highlight")] 1211 Highlight(Box<crate::pub_leaflet::richtext::facet::Highlight<'a>>), 1212 #[serde(rename = "pub.leaflet.richtext.facet#underline")] 1213 Underline(Box<crate::pub_leaflet::richtext::facet::Underline<'a>>), 1214 #[serde(rename = "pub.leaflet.richtext.facet#strikethrough")] 1215 Strikethrough(Box<crate::pub_leaflet::richtext::facet::Strikethrough<'a>>), 1216 #[serde(rename = "pub.leaflet.richtext.facet#id")] 1217 Id(Box<crate::pub_leaflet::richtext::facet::Id<'a>>), 1218 #[serde(rename = "pub.leaflet.richtext.facet#bold")] 1219 Bold(Box<crate::pub_leaflet::richtext::facet::Bold<'a>>), 1220 #[serde(rename = "pub.leaflet.richtext.facet#italic")] 1221 Italic(Box<crate::pub_leaflet::richtext::facet::Italic<'a>>), 1222} 1223 1224impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Facet<'a> { 1225 fn nsid() -> &'static str { 1226 "pub.leaflet.richtext.facet" 1227 } 1228 fn def_name() -> &'static str { 1229 "main" 1230 } 1231 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1232 lexicon_doc_pub_leaflet_richtext_facet() 1233 } 1234 fn validate( 1235 &self, 1236 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1237 Ok(()) 1238 } 1239} 1240 1241/// Facet feature for strikethrough markup 1242#[jacquard_derive::lexicon] 1243#[derive( 1244 serde::Serialize, 1245 serde::Deserialize, 1246 Debug, 1247 Clone, 1248 PartialEq, 1249 Eq, 1250 jacquard_derive::IntoStatic, 1251 Default 1252)] 1253#[serde(rename_all = "camelCase")] 1254pub struct Strikethrough<'a> {} 1255impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Strikethrough<'a> { 1256 fn nsid() -> &'static str { 1257 "pub.leaflet.richtext.facet" 1258 } 1259 fn def_name() -> &'static str { 1260 "strikethrough" 1261 } 1262 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1263 lexicon_doc_pub_leaflet_richtext_facet() 1264 } 1265 fn validate( 1266 &self, 1267 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1268 Ok(()) 1269 } 1270} 1271 1272/// Facet feature for underline markup 1273#[jacquard_derive::lexicon] 1274#[derive( 1275 serde::Serialize, 1276 serde::Deserialize, 1277 Debug, 1278 Clone, 1279 PartialEq, 1280 Eq, 1281 jacquard_derive::IntoStatic, 1282 Default 1283)] 1284#[serde(rename_all = "camelCase")] 1285pub struct Underline<'a> {} 1286impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Underline<'a> { 1287 fn nsid() -> &'static str { 1288 "pub.leaflet.richtext.facet" 1289 } 1290 fn def_name() -> &'static str { 1291 "underline" 1292 } 1293 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1294 lexicon_doc_pub_leaflet_richtext_facet() 1295 } 1296 fn validate( 1297 &self, 1298 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1299 Ok(()) 1300 } 1301}