atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: pub.leaflet.pages.linearDocument
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 Block<'a> {
20 #[serde(skip_serializing_if = "std::option::Option::is_none")]
21 #[serde(borrow)]
22 pub alignment: std::option::Option<BlockAlignment<'a>>,
23 #[serde(borrow)]
24 pub block: BlockBlock<'a>,
25}
26
27pub mod block_state {
28
29 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
30 #[allow(unused)]
31 use ::core::marker::PhantomData;
32 mod sealed {
33 pub trait Sealed {}
34 }
35 /// State trait tracking which required fields have been set
36 pub trait State: sealed::Sealed {
37 type Block;
38 }
39 /// Empty state - all required fields are unset
40 pub struct Empty(());
41 impl sealed::Sealed for Empty {}
42 impl State for Empty {
43 type Block = Unset;
44 }
45 ///State transition - sets the `block` field to Set
46 pub struct SetBlock<S: State = Empty>(PhantomData<fn() -> S>);
47 impl<S: State> sealed::Sealed for SetBlock<S> {}
48 impl<S: State> State for SetBlock<S> {
49 type Block = Set<members::block>;
50 }
51 /// Marker types for field names
52 #[allow(non_camel_case_types)]
53 pub mod members {
54 ///Marker type for the `block` field
55 pub struct block(());
56 }
57}
58
59/// Builder for constructing an instance of this type
60pub struct BlockBuilder<'a, S: block_state::State> {
61 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
62 __unsafe_private_named: (
63 ::core::option::Option<BlockAlignment<'a>>,
64 ::core::option::Option<BlockBlock<'a>>,
65 ),
66 _phantom: ::core::marker::PhantomData<&'a ()>,
67}
68
69impl<'a> Block<'a> {
70 /// Create a new builder for this type
71 pub fn new() -> BlockBuilder<'a, block_state::Empty> {
72 BlockBuilder::new()
73 }
74}
75
76impl<'a> BlockBuilder<'a, block_state::Empty> {
77 /// Create a new builder with all fields unset
78 pub fn new() -> Self {
79 BlockBuilder {
80 _phantom_state: ::core::marker::PhantomData,
81 __unsafe_private_named: (None, None),
82 _phantom: ::core::marker::PhantomData,
83 }
84 }
85}
86
87impl<'a, S: block_state::State> BlockBuilder<'a, S> {
88 /// Set the `alignment` field (optional)
89 pub fn alignment(mut self, value: impl Into<Option<BlockAlignment<'a>>>) -> Self {
90 self.__unsafe_private_named.0 = value.into();
91 self
92 }
93 /// Set the `alignment` field to an Option value (optional)
94 pub fn maybe_alignment(mut self, value: Option<BlockAlignment<'a>>) -> Self {
95 self.__unsafe_private_named.0 = value;
96 self
97 }
98}
99
100impl<'a, S> BlockBuilder<'a, S>
101where
102 S: block_state::State,
103 S::Block: block_state::IsUnset,
104{
105 /// Set the `block` field (required)
106 pub fn block(
107 mut self,
108 value: impl Into<BlockBlock<'a>>,
109 ) -> BlockBuilder<'a, block_state::SetBlock<S>> {
110 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
111 BlockBuilder {
112 _phantom_state: ::core::marker::PhantomData,
113 __unsafe_private_named: self.__unsafe_private_named,
114 _phantom: ::core::marker::PhantomData,
115 }
116 }
117}
118
119impl<'a, S> BlockBuilder<'a, S>
120where
121 S: block_state::State,
122 S::Block: block_state::IsSet,
123{
124 /// Build the final struct
125 pub fn build(self) -> Block<'a> {
126 Block {
127 alignment: self.__unsafe_private_named.0,
128 block: self.__unsafe_private_named.1.unwrap(),
129 extra_data: Default::default(),
130 }
131 }
132 /// Build the final struct with custom extra_data
133 pub fn build_with_data(
134 self,
135 extra_data: std::collections::BTreeMap<
136 jacquard_common::smol_str::SmolStr,
137 jacquard_common::types::value::Data<'a>,
138 >,
139 ) -> Block<'a> {
140 Block {
141 alignment: self.__unsafe_private_named.0,
142 block: self.__unsafe_private_named.1.unwrap(),
143 extra_data: Some(extra_data),
144 }
145 }
146}
147
148#[derive(Debug, Clone, PartialEq, Eq, Hash)]
149pub enum BlockAlignment<'a> {
150 TextAlignLeft,
151 TextAlignCenter,
152 TextAlignRight,
153 TextAlignJustify,
154 Other(jacquard_common::CowStr<'a>),
155}
156
157impl<'a> BlockAlignment<'a> {
158 pub fn as_str(&self) -> &str {
159 match self {
160 Self::TextAlignLeft => "#textAlignLeft",
161 Self::TextAlignCenter => "#textAlignCenter",
162 Self::TextAlignRight => "#textAlignRight",
163 Self::TextAlignJustify => "#textAlignJustify",
164 Self::Other(s) => s.as_ref(),
165 }
166 }
167}
168
169impl<'a> From<&'a str> for BlockAlignment<'a> {
170 fn from(s: &'a str) -> Self {
171 match s {
172 "#textAlignLeft" => Self::TextAlignLeft,
173 "#textAlignCenter" => Self::TextAlignCenter,
174 "#textAlignRight" => Self::TextAlignRight,
175 "#textAlignJustify" => Self::TextAlignJustify,
176 _ => Self::Other(jacquard_common::CowStr::from(s)),
177 }
178 }
179}
180
181impl<'a> From<String> for BlockAlignment<'a> {
182 fn from(s: String) -> Self {
183 match s.as_str() {
184 "#textAlignLeft" => Self::TextAlignLeft,
185 "#textAlignCenter" => Self::TextAlignCenter,
186 "#textAlignRight" => Self::TextAlignRight,
187 "#textAlignJustify" => Self::TextAlignJustify,
188 _ => Self::Other(jacquard_common::CowStr::from(s)),
189 }
190 }
191}
192
193impl<'a> core::fmt::Display for BlockAlignment<'a> {
194 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
195 write!(f, "{}", self.as_str())
196 }
197}
198
199impl<'a> AsRef<str> for BlockAlignment<'a> {
200 fn as_ref(&self) -> &str {
201 self.as_str()
202 }
203}
204
205impl<'a> serde::Serialize for BlockAlignment<'a> {
206 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
207 where
208 S: serde::Serializer,
209 {
210 serializer.serialize_str(self.as_str())
211 }
212}
213
214impl<'de, 'a> serde::Deserialize<'de> for BlockAlignment<'a>
215where
216 'de: 'a,
217{
218 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
219 where
220 D: serde::Deserializer<'de>,
221 {
222 let s = <&'de str>::deserialize(deserializer)?;
223 Ok(Self::from(s))
224 }
225}
226
227impl<'a> Default for BlockAlignment<'a> {
228 fn default() -> Self {
229 Self::Other(Default::default())
230 }
231}
232
233impl jacquard_common::IntoStatic for BlockAlignment<'_> {
234 type Output = BlockAlignment<'static>;
235 fn into_static(self) -> Self::Output {
236 match self {
237 BlockAlignment::TextAlignLeft => BlockAlignment::TextAlignLeft,
238 BlockAlignment::TextAlignCenter => BlockAlignment::TextAlignCenter,
239 BlockAlignment::TextAlignRight => BlockAlignment::TextAlignRight,
240 BlockAlignment::TextAlignJustify => BlockAlignment::TextAlignJustify,
241 BlockAlignment::Other(v) => BlockAlignment::Other(v.into_static()),
242 }
243 }
244}
245
246#[jacquard_derive::open_union]
247#[derive(
248 serde::Serialize,
249 serde::Deserialize,
250 Debug,
251 Clone,
252 PartialEq,
253 Eq,
254 jacquard_derive::IntoStatic
255)]
256#[serde(tag = "$type")]
257#[serde(bound(deserialize = "'de: 'a"))]
258pub enum BlockBlock<'a> {
259 #[serde(rename = "pub.leaflet.blocks.iframe")]
260 Iframe(Box<crate::pub_leaflet::blocks::iframe::Iframe<'a>>),
261 #[serde(rename = "pub.leaflet.blocks.text")]
262 Text(Box<crate::pub_leaflet::blocks::text::Text<'a>>),
263 #[serde(rename = "pub.leaflet.blocks.blockquote")]
264 Blockquote(Box<crate::pub_leaflet::blocks::blockquote::Blockquote<'a>>),
265 #[serde(rename = "pub.leaflet.blocks.header")]
266 Header(Box<crate::pub_leaflet::blocks::header::Header<'a>>),
267 #[serde(rename = "pub.leaflet.blocks.image")]
268 Image(Box<crate::pub_leaflet::blocks::image::Image<'a>>),
269 #[serde(rename = "pub.leaflet.blocks.unorderedList")]
270 UnorderedList(Box<crate::pub_leaflet::blocks::unordered_list::UnorderedList<'a>>),
271 #[serde(rename = "pub.leaflet.blocks.website")]
272 Website(Box<crate::pub_leaflet::blocks::website::Website<'a>>),
273 #[serde(rename = "pub.leaflet.blocks.math")]
274 Math(Box<crate::pub_leaflet::blocks::math::Math<'a>>),
275 #[serde(rename = "pub.leaflet.blocks.code")]
276 Code(Box<crate::pub_leaflet::blocks::code::Code<'a>>),
277 #[serde(rename = "pub.leaflet.blocks.horizontalRule")]
278 HorizontalRule(Box<crate::pub_leaflet::blocks::horizontal_rule::HorizontalRule<'a>>),
279 #[serde(rename = "pub.leaflet.blocks.bskyPost")]
280 BskyPost(Box<crate::pub_leaflet::blocks::bsky_post::BskyPost<'a>>),
281 #[serde(rename = "pub.leaflet.blocks.page")]
282 Page(Box<crate::pub_leaflet::blocks::page::Page<'a>>),
283 #[serde(rename = "pub.leaflet.blocks.poll")]
284 Poll(Box<crate::pub_leaflet::blocks::poll::Poll<'a>>),
285 #[serde(rename = "pub.leaflet.blocks.button")]
286 Button(Box<crate::pub_leaflet::blocks::button::Button<'a>>),
287}
288
289fn lexicon_doc_pub_leaflet_pages_linearDocument() -> ::jacquard_lexicon::lexicon::LexiconDoc<
290 'static,
291> {
292 ::jacquard_lexicon::lexicon::LexiconDoc {
293 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
294 id: ::jacquard_common::CowStr::new_static("pub.leaflet.pages.linearDocument"),
295 revision: None,
296 description: None,
297 defs: {
298 let mut map = ::alloc::collections::BTreeMap::new();
299 map.insert(
300 ::jacquard_common::smol_str::SmolStr::new_static("block"),
301 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
302 description: None,
303 required: Some(
304 vec![::jacquard_common::smol_str::SmolStr::new_static("block")],
305 ),
306 nullable: None,
307 properties: {
308 #[allow(unused_mut)]
309 let mut map = ::alloc::collections::BTreeMap::new();
310 map.insert(
311 ::jacquard_common::smol_str::SmolStr::new_static(
312 "alignment",
313 ),
314 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
315 description: None,
316 format: None,
317 default: None,
318 min_length: None,
319 max_length: None,
320 min_graphemes: None,
321 max_graphemes: None,
322 r#enum: None,
323 r#const: None,
324 known_values: None,
325 }),
326 );
327 map.insert(
328 ::jacquard_common::smol_str::SmolStr::new_static("block"),
329 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
330 description: None,
331 refs: vec![
332 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.iframe"),
333 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.text"),
334 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.blockquote"),
335 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.header"),
336 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.image"),
337 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.unorderedList"),
338 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.website"),
339 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.math"),
340 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.code"),
341 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.horizontalRule"),
342 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.bskyPost"),
343 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.page"),
344 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.poll"),
345 ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.button")
346 ],
347 closed: None,
348 }),
349 );
350 map
351 },
352 }),
353 );
354 map.insert(
355 ::jacquard_common::smol_str::SmolStr::new_static("main"),
356 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
357 description: None,
358 required: Some(
359 vec![::jacquard_common::smol_str::SmolStr::new_static("blocks")],
360 ),
361 nullable: None,
362 properties: {
363 #[allow(unused_mut)]
364 let mut map = ::alloc::collections::BTreeMap::new();
365 map.insert(
366 ::jacquard_common::smol_str::SmolStr::new_static("blocks"),
367 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
368 description: None,
369 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
370 description: None,
371 r#ref: ::jacquard_common::CowStr::new_static("#block"),
372 }),
373 min_length: None,
374 max_length: None,
375 }),
376 );
377 map.insert(
378 ::jacquard_common::smol_str::SmolStr::new_static("id"),
379 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
380 description: None,
381 format: None,
382 default: None,
383 min_length: None,
384 max_length: None,
385 min_graphemes: None,
386 max_graphemes: None,
387 r#enum: None,
388 r#const: None,
389 known_values: None,
390 }),
391 );
392 map
393 },
394 }),
395 );
396 map.insert(
397 ::jacquard_common::smol_str::SmolStr::new_static("position"),
398 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
399 description: None,
400 required: Some(
401 vec![
402 ::jacquard_common::smol_str::SmolStr::new_static("block"),
403 ::jacquard_common::smol_str::SmolStr::new_static("offset")
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("block"),
412 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
413 description: None,
414 items: ::jacquard_lexicon::lexicon::LexArrayItem::Integer(::jacquard_lexicon::lexicon::LexInteger {
415 description: None,
416 default: None,
417 minimum: None,
418 maximum: None,
419 r#enum: None,
420 r#const: None,
421 }),
422 min_length: None,
423 max_length: None,
424 }),
425 );
426 map.insert(
427 ::jacquard_common::smol_str::SmolStr::new_static("offset"),
428 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
429 description: None,
430 default: None,
431 minimum: None,
432 maximum: None,
433 r#enum: None,
434 r#const: None,
435 }),
436 );
437 map
438 },
439 }),
440 );
441 map.insert(
442 ::jacquard_common::smol_str::SmolStr::new_static("quote"),
443 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
444 description: None,
445 required: Some(
446 vec![
447 ::jacquard_common::smol_str::SmolStr::new_static("start"),
448 ::jacquard_common::smol_str::SmolStr::new_static("end")
449 ],
450 ),
451 nullable: None,
452 properties: {
453 #[allow(unused_mut)]
454 let mut map = ::alloc::collections::BTreeMap::new();
455 map.insert(
456 ::jacquard_common::smol_str::SmolStr::new_static("end"),
457 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
458 description: None,
459 r#ref: ::jacquard_common::CowStr::new_static("#position"),
460 }),
461 );
462 map.insert(
463 ::jacquard_common::smol_str::SmolStr::new_static("start"),
464 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
465 description: None,
466 r#ref: ::jacquard_common::CowStr::new_static("#position"),
467 }),
468 );
469 map
470 },
471 }),
472 );
473 map.insert(
474 ::jacquard_common::smol_str::SmolStr::new_static("textAlignCenter"),
475 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
476 description: None,
477 }),
478 );
479 map.insert(
480 ::jacquard_common::smol_str::SmolStr::new_static("textAlignJustify"),
481 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
482 description: None,
483 }),
484 );
485 map.insert(
486 ::jacquard_common::smol_str::SmolStr::new_static("textAlignLeft"),
487 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
488 description: None,
489 }),
490 );
491 map.insert(
492 ::jacquard_common::smol_str::SmolStr::new_static("textAlignRight"),
493 ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken {
494 description: None,
495 }),
496 );
497 map
498 },
499 }
500}
501
502impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Block<'a> {
503 fn nsid() -> &'static str {
504 "pub.leaflet.pages.linearDocument"
505 }
506 fn def_name() -> &'static str {
507 "block"
508 }
509 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
510 lexicon_doc_pub_leaflet_pages_linearDocument()
511 }
512 fn validate(
513 &self,
514 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
515 Ok(())
516 }
517}
518
519#[jacquard_derive::lexicon]
520#[derive(
521 serde::Serialize,
522 serde::Deserialize,
523 Debug,
524 Clone,
525 PartialEq,
526 Eq,
527 jacquard_derive::IntoStatic
528)]
529#[serde(rename_all = "camelCase")]
530pub struct LinearDocument<'a> {
531 #[serde(borrow)]
532 pub blocks: Vec<crate::pub_leaflet::pages::linear_document::Block<'a>>,
533 #[serde(skip_serializing_if = "std::option::Option::is_none")]
534 #[serde(borrow)]
535 pub id: std::option::Option<jacquard_common::CowStr<'a>>,
536}
537
538pub mod linear_document_state {
539
540 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
541 #[allow(unused)]
542 use ::core::marker::PhantomData;
543 mod sealed {
544 pub trait Sealed {}
545 }
546 /// State trait tracking which required fields have been set
547 pub trait State: sealed::Sealed {
548 type Blocks;
549 }
550 /// Empty state - all required fields are unset
551 pub struct Empty(());
552 impl sealed::Sealed for Empty {}
553 impl State for Empty {
554 type Blocks = Unset;
555 }
556 ///State transition - sets the `blocks` field to Set
557 pub struct SetBlocks<S: State = Empty>(PhantomData<fn() -> S>);
558 impl<S: State> sealed::Sealed for SetBlocks<S> {}
559 impl<S: State> State for SetBlocks<S> {
560 type Blocks = Set<members::blocks>;
561 }
562 /// Marker types for field names
563 #[allow(non_camel_case_types)]
564 pub mod members {
565 ///Marker type for the `blocks` field
566 pub struct blocks(());
567 }
568}
569
570/// Builder for constructing an instance of this type
571pub struct LinearDocumentBuilder<'a, S: linear_document_state::State> {
572 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
573 __unsafe_private_named: (
574 ::core::option::Option<
575 Vec<crate::pub_leaflet::pages::linear_document::Block<'a>>,
576 >,
577 ::core::option::Option<jacquard_common::CowStr<'a>>,
578 ),
579 _phantom: ::core::marker::PhantomData<&'a ()>,
580}
581
582impl<'a> LinearDocument<'a> {
583 /// Create a new builder for this type
584 pub fn new() -> LinearDocumentBuilder<'a, linear_document_state::Empty> {
585 LinearDocumentBuilder::new()
586 }
587}
588
589impl<'a> LinearDocumentBuilder<'a, linear_document_state::Empty> {
590 /// Create a new builder with all fields unset
591 pub fn new() -> Self {
592 LinearDocumentBuilder {
593 _phantom_state: ::core::marker::PhantomData,
594 __unsafe_private_named: (None, None),
595 _phantom: ::core::marker::PhantomData,
596 }
597 }
598}
599
600impl<'a, S> LinearDocumentBuilder<'a, S>
601where
602 S: linear_document_state::State,
603 S::Blocks: linear_document_state::IsUnset,
604{
605 /// Set the `blocks` field (required)
606 pub fn blocks(
607 mut self,
608 value: impl Into<Vec<crate::pub_leaflet::pages::linear_document::Block<'a>>>,
609 ) -> LinearDocumentBuilder<'a, linear_document_state::SetBlocks<S>> {
610 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
611 LinearDocumentBuilder {
612 _phantom_state: ::core::marker::PhantomData,
613 __unsafe_private_named: self.__unsafe_private_named,
614 _phantom: ::core::marker::PhantomData,
615 }
616 }
617}
618
619impl<'a, S: linear_document_state::State> LinearDocumentBuilder<'a, S> {
620 /// Set the `id` field (optional)
621 pub fn id(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self {
622 self.__unsafe_private_named.1 = value.into();
623 self
624 }
625 /// Set the `id` field to an Option value (optional)
626 pub fn maybe_id(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
627 self.__unsafe_private_named.1 = value;
628 self
629 }
630}
631
632impl<'a, S> LinearDocumentBuilder<'a, S>
633where
634 S: linear_document_state::State,
635 S::Blocks: linear_document_state::IsSet,
636{
637 /// Build the final struct
638 pub fn build(self) -> LinearDocument<'a> {
639 LinearDocument {
640 blocks: self.__unsafe_private_named.0.unwrap(),
641 id: self.__unsafe_private_named.1,
642 extra_data: Default::default(),
643 }
644 }
645 /// Build the final struct with custom extra_data
646 pub fn build_with_data(
647 self,
648 extra_data: std::collections::BTreeMap<
649 jacquard_common::smol_str::SmolStr,
650 jacquard_common::types::value::Data<'a>,
651 >,
652 ) -> LinearDocument<'a> {
653 LinearDocument {
654 blocks: self.__unsafe_private_named.0.unwrap(),
655 id: self.__unsafe_private_named.1,
656 extra_data: Some(extra_data),
657 }
658 }
659}
660
661impl<'a> ::jacquard_lexicon::schema::LexiconSchema for LinearDocument<'a> {
662 fn nsid() -> &'static str {
663 "pub.leaflet.pages.linearDocument"
664 }
665 fn def_name() -> &'static str {
666 "main"
667 }
668 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
669 lexicon_doc_pub_leaflet_pages_linearDocument()
670 }
671 fn validate(
672 &self,
673 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
674 Ok(())
675 }
676}
677
678#[jacquard_derive::lexicon]
679#[derive(
680 serde::Serialize,
681 serde::Deserialize,
682 Debug,
683 Clone,
684 PartialEq,
685 Eq,
686 jacquard_derive::IntoStatic
687)]
688#[serde(rename_all = "camelCase")]
689pub struct Position<'a> {
690 pub block: Vec<i64>,
691 pub offset: i64,
692}
693
694pub mod position_state {
695
696 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
697 #[allow(unused)]
698 use ::core::marker::PhantomData;
699 mod sealed {
700 pub trait Sealed {}
701 }
702 /// State trait tracking which required fields have been set
703 pub trait State: sealed::Sealed {
704 type Offset;
705 type Block;
706 }
707 /// Empty state - all required fields are unset
708 pub struct Empty(());
709 impl sealed::Sealed for Empty {}
710 impl State for Empty {
711 type Offset = Unset;
712 type Block = Unset;
713 }
714 ///State transition - sets the `offset` field to Set
715 pub struct SetOffset<S: State = Empty>(PhantomData<fn() -> S>);
716 impl<S: State> sealed::Sealed for SetOffset<S> {}
717 impl<S: State> State for SetOffset<S> {
718 type Offset = Set<members::offset>;
719 type Block = S::Block;
720 }
721 ///State transition - sets the `block` field to Set
722 pub struct SetBlock<S: State = Empty>(PhantomData<fn() -> S>);
723 impl<S: State> sealed::Sealed for SetBlock<S> {}
724 impl<S: State> State for SetBlock<S> {
725 type Offset = S::Offset;
726 type Block = Set<members::block>;
727 }
728 /// Marker types for field names
729 #[allow(non_camel_case_types)]
730 pub mod members {
731 ///Marker type for the `offset` field
732 pub struct offset(());
733 ///Marker type for the `block` field
734 pub struct block(());
735 }
736}
737
738/// Builder for constructing an instance of this type
739pub struct PositionBuilder<'a, S: position_state::State> {
740 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
741 __unsafe_private_named: (
742 ::core::option::Option<Vec<i64>>,
743 ::core::option::Option<i64>,
744 ),
745 _phantom: ::core::marker::PhantomData<&'a ()>,
746}
747
748impl<'a> Position<'a> {
749 /// Create a new builder for this type
750 pub fn new() -> PositionBuilder<'a, position_state::Empty> {
751 PositionBuilder::new()
752 }
753}
754
755impl<'a> PositionBuilder<'a, position_state::Empty> {
756 /// Create a new builder with all fields unset
757 pub fn new() -> Self {
758 PositionBuilder {
759 _phantom_state: ::core::marker::PhantomData,
760 __unsafe_private_named: (None, None),
761 _phantom: ::core::marker::PhantomData,
762 }
763 }
764}
765
766impl<'a, S> PositionBuilder<'a, S>
767where
768 S: position_state::State,
769 S::Block: position_state::IsUnset,
770{
771 /// Set the `block` field (required)
772 pub fn block(
773 mut self,
774 value: impl Into<Vec<i64>>,
775 ) -> PositionBuilder<'a, position_state::SetBlock<S>> {
776 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
777 PositionBuilder {
778 _phantom_state: ::core::marker::PhantomData,
779 __unsafe_private_named: self.__unsafe_private_named,
780 _phantom: ::core::marker::PhantomData,
781 }
782 }
783}
784
785impl<'a, S> PositionBuilder<'a, S>
786where
787 S: position_state::State,
788 S::Offset: position_state::IsUnset,
789{
790 /// Set the `offset` field (required)
791 pub fn offset(
792 mut self,
793 value: impl Into<i64>,
794 ) -> PositionBuilder<'a, position_state::SetOffset<S>> {
795 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
796 PositionBuilder {
797 _phantom_state: ::core::marker::PhantomData,
798 __unsafe_private_named: self.__unsafe_private_named,
799 _phantom: ::core::marker::PhantomData,
800 }
801 }
802}
803
804impl<'a, S> PositionBuilder<'a, S>
805where
806 S: position_state::State,
807 S::Offset: position_state::IsSet,
808 S::Block: position_state::IsSet,
809{
810 /// Build the final struct
811 pub fn build(self) -> Position<'a> {
812 Position {
813 block: self.__unsafe_private_named.0.unwrap(),
814 offset: self.__unsafe_private_named.1.unwrap(),
815 extra_data: Default::default(),
816 }
817 }
818 /// Build the final struct with custom extra_data
819 pub fn build_with_data(
820 self,
821 extra_data: std::collections::BTreeMap<
822 jacquard_common::smol_str::SmolStr,
823 jacquard_common::types::value::Data<'a>,
824 >,
825 ) -> Position<'a> {
826 Position {
827 block: self.__unsafe_private_named.0.unwrap(),
828 offset: self.__unsafe_private_named.1.unwrap(),
829 extra_data: Some(extra_data),
830 }
831 }
832}
833
834impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Position<'a> {
835 fn nsid() -> &'static str {
836 "pub.leaflet.pages.linearDocument"
837 }
838 fn def_name() -> &'static str {
839 "position"
840 }
841 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
842 lexicon_doc_pub_leaflet_pages_linearDocument()
843 }
844 fn validate(
845 &self,
846 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
847 Ok(())
848 }
849}
850
851#[jacquard_derive::lexicon]
852#[derive(
853 serde::Serialize,
854 serde::Deserialize,
855 Debug,
856 Clone,
857 PartialEq,
858 Eq,
859 jacquard_derive::IntoStatic
860)]
861#[serde(rename_all = "camelCase")]
862pub struct Quote<'a> {
863 #[serde(borrow)]
864 pub end: crate::pub_leaflet::pages::linear_document::Position<'a>,
865 #[serde(borrow)]
866 pub start: crate::pub_leaflet::pages::linear_document::Position<'a>,
867}
868
869pub mod quote_state {
870
871 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
872 #[allow(unused)]
873 use ::core::marker::PhantomData;
874 mod sealed {
875 pub trait Sealed {}
876 }
877 /// State trait tracking which required fields have been set
878 pub trait State: sealed::Sealed {
879 type Start;
880 type End;
881 }
882 /// Empty state - all required fields are unset
883 pub struct Empty(());
884 impl sealed::Sealed for Empty {}
885 impl State for Empty {
886 type Start = Unset;
887 type End = Unset;
888 }
889 ///State transition - sets the `start` field to Set
890 pub struct SetStart<S: State = Empty>(PhantomData<fn() -> S>);
891 impl<S: State> sealed::Sealed for SetStart<S> {}
892 impl<S: State> State for SetStart<S> {
893 type Start = Set<members::start>;
894 type End = S::End;
895 }
896 ///State transition - sets the `end` field to Set
897 pub struct SetEnd<S: State = Empty>(PhantomData<fn() -> S>);
898 impl<S: State> sealed::Sealed for SetEnd<S> {}
899 impl<S: State> State for SetEnd<S> {
900 type Start = S::Start;
901 type End = Set<members::end>;
902 }
903 /// Marker types for field names
904 #[allow(non_camel_case_types)]
905 pub mod members {
906 ///Marker type for the `start` field
907 pub struct start(());
908 ///Marker type for the `end` field
909 pub struct end(());
910 }
911}
912
913/// Builder for constructing an instance of this type
914pub struct QuoteBuilder<'a, S: quote_state::State> {
915 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
916 __unsafe_private_named: (
917 ::core::option::Option<crate::pub_leaflet::pages::linear_document::Position<'a>>,
918 ::core::option::Option<crate::pub_leaflet::pages::linear_document::Position<'a>>,
919 ),
920 _phantom: ::core::marker::PhantomData<&'a ()>,
921}
922
923impl<'a> Quote<'a> {
924 /// Create a new builder for this type
925 pub fn new() -> QuoteBuilder<'a, quote_state::Empty> {
926 QuoteBuilder::new()
927 }
928}
929
930impl<'a> QuoteBuilder<'a, quote_state::Empty> {
931 /// Create a new builder with all fields unset
932 pub fn new() -> Self {
933 QuoteBuilder {
934 _phantom_state: ::core::marker::PhantomData,
935 __unsafe_private_named: (None, None),
936 _phantom: ::core::marker::PhantomData,
937 }
938 }
939}
940
941impl<'a, S> QuoteBuilder<'a, S>
942where
943 S: quote_state::State,
944 S::End: quote_state::IsUnset,
945{
946 /// Set the `end` field (required)
947 pub fn end(
948 mut self,
949 value: impl Into<crate::pub_leaflet::pages::linear_document::Position<'a>>,
950 ) -> QuoteBuilder<'a, quote_state::SetEnd<S>> {
951 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
952 QuoteBuilder {
953 _phantom_state: ::core::marker::PhantomData,
954 __unsafe_private_named: self.__unsafe_private_named,
955 _phantom: ::core::marker::PhantomData,
956 }
957 }
958}
959
960impl<'a, S> QuoteBuilder<'a, S>
961where
962 S: quote_state::State,
963 S::Start: quote_state::IsUnset,
964{
965 /// Set the `start` field (required)
966 pub fn start(
967 mut self,
968 value: impl Into<crate::pub_leaflet::pages::linear_document::Position<'a>>,
969 ) -> QuoteBuilder<'a, quote_state::SetStart<S>> {
970 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
971 QuoteBuilder {
972 _phantom_state: ::core::marker::PhantomData,
973 __unsafe_private_named: self.__unsafe_private_named,
974 _phantom: ::core::marker::PhantomData,
975 }
976 }
977}
978
979impl<'a, S> QuoteBuilder<'a, S>
980where
981 S: quote_state::State,
982 S::Start: quote_state::IsSet,
983 S::End: quote_state::IsSet,
984{
985 /// Build the final struct
986 pub fn build(self) -> Quote<'a> {
987 Quote {
988 end: self.__unsafe_private_named.0.unwrap(),
989 start: self.__unsafe_private_named.1.unwrap(),
990 extra_data: Default::default(),
991 }
992 }
993 /// Build the final struct with custom extra_data
994 pub fn build_with_data(
995 self,
996 extra_data: std::collections::BTreeMap<
997 jacquard_common::smol_str::SmolStr,
998 jacquard_common::types::value::Data<'a>,
999 >,
1000 ) -> Quote<'a> {
1001 Quote {
1002 end: self.__unsafe_private_named.0.unwrap(),
1003 start: self.__unsafe_private_named.1.unwrap(),
1004 extra_data: Some(extra_data),
1005 }
1006 }
1007}
1008
1009impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Quote<'a> {
1010 fn nsid() -> &'static str {
1011 "pub.leaflet.pages.linearDocument"
1012 }
1013 fn def_name() -> &'static str {
1014 "quote"
1015 }
1016 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1017 lexicon_doc_pub_leaflet_pages_linearDocument()
1018 }
1019 fn validate(
1020 &self,
1021 ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1022 Ok(())
1023 }
1024}
1025
1026#[derive(
1027 serde::Serialize,
1028 serde::Deserialize,
1029 Debug,
1030 Clone,
1031 PartialEq,
1032 Eq,
1033 Hash,
1034 jacquard_derive::IntoStatic
1035)]
1036pub struct TextAlignCenter;
1037impl std::fmt::Display for TextAlignCenter {
1038 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1039 write!(f, "textAlignCenter")
1040 }
1041}
1042
1043#[derive(
1044 serde::Serialize,
1045 serde::Deserialize,
1046 Debug,
1047 Clone,
1048 PartialEq,
1049 Eq,
1050 Hash,
1051 jacquard_derive::IntoStatic
1052)]
1053pub struct TextAlignJustify;
1054impl std::fmt::Display for TextAlignJustify {
1055 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1056 write!(f, "textAlignJustify")
1057 }
1058}
1059
1060#[derive(
1061 serde::Serialize,
1062 serde::Deserialize,
1063 Debug,
1064 Clone,
1065 PartialEq,
1066 Eq,
1067 Hash,
1068 jacquard_derive::IntoStatic
1069)]
1070pub struct TextAlignLeft;
1071impl std::fmt::Display for TextAlignLeft {
1072 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1073 write!(f, "textAlignLeft")
1074 }
1075}
1076
1077#[derive(
1078 serde::Serialize,
1079 serde::Deserialize,
1080 Debug,
1081 Clone,
1082 PartialEq,
1083 Eq,
1084 Hash,
1085 jacquard_derive::IntoStatic
1086)]
1087pub struct TextAlignRight;
1088impl std::fmt::Display for TextAlignRight {
1089 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1090 write!(f, "textAlignRight")
1091 }
1092}