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