1#[jacquard_derive::lexicon]
10#[derive(
11 serde::Serialize,
12 serde::Deserialize,
13 Debug,
14 Clone,
15 PartialEq,
16 Eq,
17 jacquard_derive::IntoStatic,
18 Default
19)]
20#[serde(rename_all = "camelCase")]
21pub struct Bold<'a> {}
22fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::LexiconDoc<
23 'static,
24> {
25 ::jacquard_lexicon::lexicon::LexiconDoc {
26 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
27 id: ::jacquard_common::CowStr::new_static("pub.leaflet.richtext.facet"),
28 revision: None,
29 description: None,
30 defs: {
31 let mut map = ::std::collections::BTreeMap::new();
32 map.insert(
33 ::jacquard_common::smol_str::SmolStr::new_static("bold"),
34 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
35 description: Some(
36 ::jacquard_common::CowStr::new_static(
37 "Facet feature for bold text",
38 ),
39 ),
40 required: Some(vec![]),
41 nullable: None,
42 properties: {
43 #[allow(unused_mut)]
44 let mut map = ::std::collections::BTreeMap::new();
45 map
46 },
47 }),
48 );
49 map.insert(
50 ::jacquard_common::smol_str::SmolStr::new_static("byteSlice"),
51 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
52 description: Some(
53 ::jacquard_common::CowStr::new_static(
54 "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.",
55 ),
56 ),
57 required: Some(
58 vec![
59 ::jacquard_common::smol_str::SmolStr::new_static("byteStart"),
60 ::jacquard_common::smol_str::SmolStr::new_static("byteEnd")
61 ],
62 ),
63 nullable: None,
64 properties: {
65 #[allow(unused_mut)]
66 let mut map = ::std::collections::BTreeMap::new();
67 map.insert(
68 ::jacquard_common::smol_str::SmolStr::new_static("byteEnd"),
69 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
70 description: None,
71 default: None,
72 minimum: Some(0i64),
73 maximum: None,
74 r#enum: None,
75 r#const: None,
76 }),
77 );
78 map.insert(
79 ::jacquard_common::smol_str::SmolStr::new_static(
80 "byteStart",
81 ),
82 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
83 description: None,
84 default: None,
85 minimum: Some(0i64),
86 maximum: None,
87 r#enum: None,
88 r#const: None,
89 }),
90 );
91 map
92 },
93 }),
94 );
95 map.insert(
96 ::jacquard_common::smol_str::SmolStr::new_static("code"),
97 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
98 description: Some(
99 ::jacquard_common::CowStr::new_static(
100 "Facet feature for inline code.",
101 ),
102 ),
103 required: Some(vec![]),
104 nullable: None,
105 properties: {
106 #[allow(unused_mut)]
107 let mut map = ::std::collections::BTreeMap::new();
108 map
109 },
110 }),
111 );
112 map.insert(
113 ::jacquard_common::smol_str::SmolStr::new_static("highlight"),
114 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
115 description: Some(
116 ::jacquard_common::CowStr::new_static(
117 "Facet feature for highlighted text.",
118 ),
119 ),
120 required: Some(vec![]),
121 nullable: None,
122 properties: {
123 #[allow(unused_mut)]
124 let mut map = ::std::collections::BTreeMap::new();
125 map
126 },
127 }),
128 );
129 map.insert(
130 ::jacquard_common::smol_str::SmolStr::new_static("id"),
131 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
132 description: Some(
133 ::jacquard_common::CowStr::new_static(
134 "Facet feature for an identifier. Used for linking to a segment",
135 ),
136 ),
137 required: Some(vec![]),
138 nullable: None,
139 properties: {
140 #[allow(unused_mut)]
141 let mut map = ::std::collections::BTreeMap::new();
142 map.insert(
143 ::jacquard_common::smol_str::SmolStr::new_static("id"),
144 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
145 description: None,
146 format: None,
147 default: None,
148 min_length: None,
149 max_length: None,
150 min_graphemes: None,
151 max_graphemes: None,
152 r#enum: None,
153 r#const: None,
154 known_values: None,
155 }),
156 );
157 map
158 },
159 }),
160 );
161 map.insert(
162 ::jacquard_common::smol_str::SmolStr::new_static("italic"),
163 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
164 description: Some(
165 ::jacquard_common::CowStr::new_static(
166 "Facet feature for italic text",
167 ),
168 ),
169 required: Some(vec![]),
170 nullable: None,
171 properties: {
172 #[allow(unused_mut)]
173 let mut map = ::std::collections::BTreeMap::new();
174 map
175 },
176 }),
177 );
178 map.insert(
179 ::jacquard_common::smol_str::SmolStr::new_static("link"),
180 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
181 description: Some(
182 ::jacquard_common::CowStr::new_static(
183 "Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.",
184 ),
185 ),
186 required: Some(
187 vec![::jacquard_common::smol_str::SmolStr::new_static("uri")],
188 ),
189 nullable: None,
190 properties: {
191 #[allow(unused_mut)]
192 let mut map = ::std::collections::BTreeMap::new();
193 map.insert(
194 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
195 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
196 description: None,
197 format: None,
198 default: None,
199 min_length: None,
200 max_length: None,
201 min_graphemes: None,
202 max_graphemes: None,
203 r#enum: None,
204 r#const: None,
205 known_values: None,
206 }),
207 );
208 map
209 },
210 }),
211 );
212 map.insert(
213 ::jacquard_common::smol_str::SmolStr::new_static("main"),
214 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
215 description: Some(
216 ::jacquard_common::CowStr::new_static(
217 "Annotation of a sub-string within rich text.",
218 ),
219 ),
220 required: Some(
221 vec![
222 ::jacquard_common::smol_str::SmolStr::new_static("index"),
223 ::jacquard_common::smol_str::SmolStr::new_static("features")
224 ],
225 ),
226 nullable: None,
227 properties: {
228 #[allow(unused_mut)]
229 let mut map = ::std::collections::BTreeMap::new();
230 map.insert(
231 ::jacquard_common::smol_str::SmolStr::new_static("features"),
232 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
233 description: None,
234 items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion {
235 description: None,
236 refs: vec![
237 ::jacquard_common::CowStr::new_static("#link"),
238 ::jacquard_common::CowStr::new_static("#code"),
239 ::jacquard_common::CowStr::new_static("#highlight"),
240 ::jacquard_common::CowStr::new_static("#underline"),
241 ::jacquard_common::CowStr::new_static("#strikethrough"),
242 ::jacquard_common::CowStr::new_static("#id"),
243 ::jacquard_common::CowStr::new_static("#bold"),
244 ::jacquard_common::CowStr::new_static("#italic")
245 ],
246 closed: None,
247 }),
248 min_length: None,
249 max_length: None,
250 }),
251 );
252 map.insert(
253 ::jacquard_common::smol_str::SmolStr::new_static("index"),
254 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
255 description: None,
256 r#ref: ::jacquard_common::CowStr::new_static("#byteSlice"),
257 }),
258 );
259 map
260 },
261 }),
262 );
263 map.insert(
264 ::jacquard_common::smol_str::SmolStr::new_static("strikethrough"),
265 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
266 description: Some(
267 ::jacquard_common::CowStr::new_static(
268 "Facet feature for strikethrough markup",
269 ),
270 ),
271 required: Some(vec![]),
272 nullable: None,
273 properties: {
274 #[allow(unused_mut)]
275 let mut map = ::std::collections::BTreeMap::new();
276 map
277 },
278 }),
279 );
280 map.insert(
281 ::jacquard_common::smol_str::SmolStr::new_static("underline"),
282 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
283 description: Some(
284 ::jacquard_common::CowStr::new_static(
285 "Facet feature for underline markup",
286 ),
287 ),
288 required: Some(vec![]),
289 nullable: None,
290 properties: {
291 #[allow(unused_mut)]
292 let mut map = ::std::collections::BTreeMap::new();
293 map
294 },
295 }),
296 );
297 map
298 },
299 }
300}
301
302impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Bold<'a> {
303 fn nsid() -> &'static str {
304 "pub.leaflet.richtext.facet"
305 }
306 fn def_name() -> &'static str {
307 "bold"
308 }
309 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
310 lexicon_doc_pub_leaflet_richtext_facet()
311 }
312 fn validate(
313 &self,
314 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
315 Ok(())
316 }
317}
318
319#[jacquard_derive::lexicon]
321#[derive(
322 serde::Serialize,
323 serde::Deserialize,
324 Debug,
325 Clone,
326 PartialEq,
327 Eq,
328 jacquard_derive::IntoStatic
329)]
330#[serde(rename_all = "camelCase")]
331pub struct ByteSlice<'a> {
332 pub byte_end: i64,
333 pub byte_start: i64,
334}
335
336pub mod byte_slice_state {
337
338 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
339 #[allow(unused)]
340 use ::core::marker::PhantomData;
341 mod sealed {
342 pub trait Sealed {}
343 }
344 pub trait State: sealed::Sealed {
346 type ByteStart;
347 type ByteEnd;
348 }
349 pub struct Empty(());
351 impl sealed::Sealed for Empty {}
352 impl State for Empty {
353 type ByteStart = Unset;
354 type ByteEnd = Unset;
355 }
356 pub struct SetByteStart<S: State = Empty>(PhantomData<fn() -> S>);
358 impl<S: State> sealed::Sealed for SetByteStart<S> {}
359 impl<S: State> State for SetByteStart<S> {
360 type ByteStart = Set<members::byte_start>;
361 type ByteEnd = S::ByteEnd;
362 }
363 pub struct SetByteEnd<S: State = Empty>(PhantomData<fn() -> S>);
365 impl<S: State> sealed::Sealed for SetByteEnd<S> {}
366 impl<S: State> State for SetByteEnd<S> {
367 type ByteStart = S::ByteStart;
368 type ByteEnd = Set<members::byte_end>;
369 }
370 #[allow(non_camel_case_types)]
372 pub mod members {
373 pub struct byte_start(());
375 pub struct byte_end(());
377 }
378}
379
380pub struct ByteSliceBuilder<'a, S: byte_slice_state::State> {
382 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
383 __unsafe_private_named: (::core::option::Option<i64>, ::core::option::Option<i64>),
384 _phantom: ::core::marker::PhantomData<&'a ()>,
385}
386
387impl<'a> ByteSlice<'a> {
388 pub fn new() -> ByteSliceBuilder<'a, byte_slice_state::Empty> {
390 ByteSliceBuilder::new()
391 }
392}
393
394impl<'a> ByteSliceBuilder<'a, byte_slice_state::Empty> {
395 pub fn new() -> Self {
397 ByteSliceBuilder {
398 _phantom_state: ::core::marker::PhantomData,
399 __unsafe_private_named: (None, None),
400 _phantom: ::core::marker::PhantomData,
401 }
402 }
403}
404
405impl<'a, S> ByteSliceBuilder<'a, S>
406where
407 S: byte_slice_state::State,
408 S::ByteEnd: byte_slice_state::IsUnset,
409{
410 pub fn byte_end(
412 mut self,
413 value: impl Into<i64>,
414 ) -> ByteSliceBuilder<'a, byte_slice_state::SetByteEnd<S>> {
415 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
416 ByteSliceBuilder {
417 _phantom_state: ::core::marker::PhantomData,
418 __unsafe_private_named: self.__unsafe_private_named,
419 _phantom: ::core::marker::PhantomData,
420 }
421 }
422}
423
424impl<'a, S> ByteSliceBuilder<'a, S>
425where
426 S: byte_slice_state::State,
427 S::ByteStart: byte_slice_state::IsUnset,
428{
429 pub fn byte_start(
431 mut self,
432 value: impl Into<i64>,
433 ) -> ByteSliceBuilder<'a, byte_slice_state::SetByteStart<S>> {
434 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
435 ByteSliceBuilder {
436 _phantom_state: ::core::marker::PhantomData,
437 __unsafe_private_named: self.__unsafe_private_named,
438 _phantom: ::core::marker::PhantomData,
439 }
440 }
441}
442
443impl<'a, S> ByteSliceBuilder<'a, S>
444where
445 S: byte_slice_state::State,
446 S::ByteStart: byte_slice_state::IsSet,
447 S::ByteEnd: byte_slice_state::IsSet,
448{
449 pub fn build(self) -> ByteSlice<'a> {
451 ByteSlice {
452 byte_end: self.__unsafe_private_named.0.unwrap(),
453 byte_start: self.__unsafe_private_named.1.unwrap(),
454 extra_data: Default::default(),
455 }
456 }
457 pub fn build_with_data(
459 self,
460 extra_data: std::collections::BTreeMap<
461 jacquard_common::smol_str::SmolStr,
462 jacquard_common::types::value::Data<'a>,
463 >,
464 ) -> ByteSlice<'a> {
465 ByteSlice {
466 byte_end: self.__unsafe_private_named.0.unwrap(),
467 byte_start: self.__unsafe_private_named.1.unwrap(),
468 extra_data: Some(extra_data),
469 }
470 }
471}
472
473impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ByteSlice<'a> {
474 fn nsid() -> &'static str {
475 "pub.leaflet.richtext.facet"
476 }
477 fn def_name() -> &'static str {
478 "byteSlice"
479 }
480 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
481 lexicon_doc_pub_leaflet_richtext_facet()
482 }
483 fn validate(
484 &self,
485 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
486 {
487 let value = &self.byte_end;
488 if *value < 0i64 {
489 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
490 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
491 "byte_end",
492 ),
493 min: 0i64,
494 actual: *value,
495 });
496 }
497 }
498 {
499 let value = &self.byte_start;
500 if *value < 0i64 {
501 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
502 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
503 "byte_start",
504 ),
505 min: 0i64,
506 actual: *value,
507 });
508 }
509 }
510 Ok(())
511 }
512}
513
514#[jacquard_derive::lexicon]
516#[derive(
517 serde::Serialize,
518 serde::Deserialize,
519 Debug,
520 Clone,
521 PartialEq,
522 Eq,
523 jacquard_derive::IntoStatic,
524 Default
525)]
526#[serde(rename_all = "camelCase")]
527pub struct Code<'a> {}
528impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Code<'a> {
529 fn nsid() -> &'static str {
530 "pub.leaflet.richtext.facet"
531 }
532 fn def_name() -> &'static str {
533 "code"
534 }
535 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
536 lexicon_doc_pub_leaflet_richtext_facet()
537 }
538 fn validate(
539 &self,
540 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
541 Ok(())
542 }
543}
544
545#[jacquard_derive::lexicon]
547#[derive(
548 serde::Serialize,
549 serde::Deserialize,
550 Debug,
551 Clone,
552 PartialEq,
553 Eq,
554 jacquard_derive::IntoStatic,
555 Default
556)]
557#[serde(rename_all = "camelCase")]
558pub struct Highlight<'a> {}
559impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Highlight<'a> {
560 fn nsid() -> &'static str {
561 "pub.leaflet.richtext.facet"
562 }
563 fn def_name() -> &'static str {
564 "highlight"
565 }
566 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
567 lexicon_doc_pub_leaflet_richtext_facet()
568 }
569 fn validate(
570 &self,
571 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
572 Ok(())
573 }
574}
575
576#[jacquard_derive::lexicon]
578#[derive(
579 serde::Serialize,
580 serde::Deserialize,
581 Debug,
582 Clone,
583 PartialEq,
584 Eq,
585 jacquard_derive::IntoStatic,
586 Default
587)]
588#[serde(rename_all = "camelCase")]
589pub struct Id<'a> {
590 #[serde(skip_serializing_if = "std::option::Option::is_none")]
591 #[serde(borrow)]
592 pub id: std::option::Option<jacquard_common::CowStr<'a>>,
593}
594
595impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Id<'a> {
596 fn nsid() -> &'static str {
597 "pub.leaflet.richtext.facet"
598 }
599 fn def_name() -> &'static str {
600 "id"
601 }
602 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
603 lexicon_doc_pub_leaflet_richtext_facet()
604 }
605 fn validate(
606 &self,
607 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
608 Ok(())
609 }
610}
611
612#[jacquard_derive::lexicon]
614#[derive(
615 serde::Serialize,
616 serde::Deserialize,
617 Debug,
618 Clone,
619 PartialEq,
620 Eq,
621 jacquard_derive::IntoStatic,
622 Default
623)]
624#[serde(rename_all = "camelCase")]
625pub struct Italic<'a> {}
626impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Italic<'a> {
627 fn nsid() -> &'static str {
628 "pub.leaflet.richtext.facet"
629 }
630 fn def_name() -> &'static str {
631 "italic"
632 }
633 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
634 lexicon_doc_pub_leaflet_richtext_facet()
635 }
636 fn validate(
637 &self,
638 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
639 Ok(())
640 }
641}
642
643#[jacquard_derive::lexicon]
645#[derive(
646 serde::Serialize,
647 serde::Deserialize,
648 Debug,
649 Clone,
650 PartialEq,
651 Eq,
652 jacquard_derive::IntoStatic,
653 Default
654)]
655#[serde(rename_all = "camelCase")]
656pub struct Link<'a> {
657 #[serde(borrow)]
658 pub uri: jacquard_common::CowStr<'a>,
659}
660
661impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Link<'a> {
662 fn nsid() -> &'static str {
663 "pub.leaflet.richtext.facet"
664 }
665 fn def_name() -> &'static str {
666 "link"
667 }
668 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
669 lexicon_doc_pub_leaflet_richtext_facet()
670 }
671 fn validate(
672 &self,
673 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
674 Ok(())
675 }
676}
677
678#[jacquard_derive::lexicon]
680#[derive(
681 serde::Serialize,
682 serde::Deserialize,
683 Debug,
684 Clone,
685 PartialEq,
686 Eq,
687 jacquard_derive::IntoStatic
688)]
689#[serde(rename_all = "camelCase")]
690pub struct Facet<'a> {
691 #[serde(borrow)]
692 pub features: Vec<FacetFeaturesItem<'a>>,
693 #[serde(borrow)]
694 pub index: crate::pub_leaflet::richtext::facet::ByteSlice<'a>,
695}
696
697pub mod facet_state {
698
699 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
700 #[allow(unused)]
701 use ::core::marker::PhantomData;
702 mod sealed {
703 pub trait Sealed {}
704 }
705 pub trait State: sealed::Sealed {
707 type Index;
708 type Features;
709 }
710 pub struct Empty(());
712 impl sealed::Sealed for Empty {}
713 impl State for Empty {
714 type Index = Unset;
715 type Features = Unset;
716 }
717 pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>);
719 impl<S: State> sealed::Sealed for SetIndex<S> {}
720 impl<S: State> State for SetIndex<S> {
721 type Index = Set<members::index>;
722 type Features = S::Features;
723 }
724 pub struct SetFeatures<S: State = Empty>(PhantomData<fn() -> S>);
726 impl<S: State> sealed::Sealed for SetFeatures<S> {}
727 impl<S: State> State for SetFeatures<S> {
728 type Index = S::Index;
729 type Features = Set<members::features>;
730 }
731 #[allow(non_camel_case_types)]
733 pub mod members {
734 pub struct index(());
736 pub struct features(());
738 }
739}
740
741pub struct FacetBuilder<'a, S: facet_state::State> {
743 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
744 __unsafe_private_named: (
745 ::core::option::Option<Vec<FacetFeaturesItem<'a>>>,
746 ::core::option::Option<crate::pub_leaflet::richtext::facet::ByteSlice<'a>>,
747 ),
748 _phantom: ::core::marker::PhantomData<&'a ()>,
749}
750
751impl<'a> Facet<'a> {
752 pub fn new() -> FacetBuilder<'a, facet_state::Empty> {
754 FacetBuilder::new()
755 }
756}
757
758impl<'a> FacetBuilder<'a, facet_state::Empty> {
759 pub fn new() -> Self {
761 FacetBuilder {
762 _phantom_state: ::core::marker::PhantomData,
763 __unsafe_private_named: (None, None),
764 _phantom: ::core::marker::PhantomData,
765 }
766 }
767}
768
769impl<'a, S> FacetBuilder<'a, S>
770where
771 S: facet_state::State,
772 S::Features: facet_state::IsUnset,
773{
774 pub fn features(
776 mut self,
777 value: impl Into<Vec<FacetFeaturesItem<'a>>>,
778 ) -> FacetBuilder<'a, facet_state::SetFeatures<S>> {
779 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
780 FacetBuilder {
781 _phantom_state: ::core::marker::PhantomData,
782 __unsafe_private_named: self.__unsafe_private_named,
783 _phantom: ::core::marker::PhantomData,
784 }
785 }
786}
787
788impl<'a, S> FacetBuilder<'a, S>
789where
790 S: facet_state::State,
791 S::Index: facet_state::IsUnset,
792{
793 pub fn index(
795 mut self,
796 value: impl Into<crate::pub_leaflet::richtext::facet::ByteSlice<'a>>,
797 ) -> FacetBuilder<'a, facet_state::SetIndex<S>> {
798 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
799 FacetBuilder {
800 _phantom_state: ::core::marker::PhantomData,
801 __unsafe_private_named: self.__unsafe_private_named,
802 _phantom: ::core::marker::PhantomData,
803 }
804 }
805}
806
807impl<'a, S> FacetBuilder<'a, S>
808where
809 S: facet_state::State,
810 S::Index: facet_state::IsSet,
811 S::Features: facet_state::IsSet,
812{
813 pub fn build(self) -> Facet<'a> {
815 Facet {
816 features: self.__unsafe_private_named.0.unwrap(),
817 index: self.__unsafe_private_named.1.unwrap(),
818 extra_data: Default::default(),
819 }
820 }
821 pub fn build_with_data(
823 self,
824 extra_data: std::collections::BTreeMap<
825 jacquard_common::smol_str::SmolStr,
826 jacquard_common::types::value::Data<'a>,
827 >,
828 ) -> Facet<'a> {
829 Facet {
830 features: self.__unsafe_private_named.0.unwrap(),
831 index: self.__unsafe_private_named.1.unwrap(),
832 extra_data: Some(extra_data),
833 }
834 }
835}
836
837#[jacquard_derive::open_union]
838#[derive(
839 serde::Serialize,
840 serde::Deserialize,
841 Debug,
842 Clone,
843 PartialEq,
844 Eq,
845 jacquard_derive::IntoStatic
846)]
847#[serde(tag = "$type")]
848#[serde(bound(deserialize = "'de: 'a"))]
849pub enum FacetFeaturesItem<'a> {
850 #[serde(rename = "pub.leaflet.richtext.facet#link")]
851 Link(Box<crate::pub_leaflet::richtext::facet::Link<'a>>),
852 #[serde(rename = "pub.leaflet.richtext.facet#code")]
853 Code(Box<crate::pub_leaflet::richtext::facet::Code<'a>>),
854 #[serde(rename = "pub.leaflet.richtext.facet#highlight")]
855 Highlight(Box<crate::pub_leaflet::richtext::facet::Highlight<'a>>),
856 #[serde(rename = "pub.leaflet.richtext.facet#underline")]
857 Underline(Box<crate::pub_leaflet::richtext::facet::Underline<'a>>),
858 #[serde(rename = "pub.leaflet.richtext.facet#strikethrough")]
859 Strikethrough(Box<crate::pub_leaflet::richtext::facet::Strikethrough<'a>>),
860 #[serde(rename = "pub.leaflet.richtext.facet#id")]
861 Id(Box<crate::pub_leaflet::richtext::facet::Id<'a>>),
862 #[serde(rename = "pub.leaflet.richtext.facet#bold")]
863 Bold(Box<crate::pub_leaflet::richtext::facet::Bold<'a>>),
864 #[serde(rename = "pub.leaflet.richtext.facet#italic")]
865 Italic(Box<crate::pub_leaflet::richtext::facet::Italic<'a>>),
866}
867
868impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Facet<'a> {
869 fn nsid() -> &'static str {
870 "pub.leaflet.richtext.facet"
871 }
872 fn def_name() -> &'static str {
873 "main"
874 }
875 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
876 lexicon_doc_pub_leaflet_richtext_facet()
877 }
878 fn validate(
879 &self,
880 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
881 Ok(())
882 }
883}
884
885#[jacquard_derive::lexicon]
887#[derive(
888 serde::Serialize,
889 serde::Deserialize,
890 Debug,
891 Clone,
892 PartialEq,
893 Eq,
894 jacquard_derive::IntoStatic,
895 Default
896)]
897#[serde(rename_all = "camelCase")]
898pub struct Strikethrough<'a> {}
899impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Strikethrough<'a> {
900 fn nsid() -> &'static str {
901 "pub.leaflet.richtext.facet"
902 }
903 fn def_name() -> &'static str {
904 "strikethrough"
905 }
906 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
907 lexicon_doc_pub_leaflet_richtext_facet()
908 }
909 fn validate(
910 &self,
911 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
912 Ok(())
913 }
914}
915
916#[jacquard_derive::lexicon]
918#[derive(
919 serde::Serialize,
920 serde::Deserialize,
921 Debug,
922 Clone,
923 PartialEq,
924 Eq,
925 jacquard_derive::IntoStatic,
926 Default
927)]
928#[serde(rename_all = "camelCase")]
929pub struct Underline<'a> {}
930impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Underline<'a> {
931 fn nsid() -> &'static str {
932 "pub.leaflet.richtext.facet"
933 }
934 fn def_name() -> &'static str {
935 "underline"
936 }
937 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
938 lexicon_doc_pub_leaflet_richtext_facet()
939 }
940 fn validate(
941 &self,
942 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
943 Ok(())
944 }
945}