// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: pub.leaflet.pages.canvas // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Block<'a> { #[serde(borrow)] pub block: BlockBlock<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub height: std::option::Option, /// The rotation of the block in degrees #[serde(skip_serializing_if = "std::option::Option::is_none")] pub rotation: std::option::Option, pub width: i64, pub x: i64, pub y: i64, } pub mod block_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type X; type Block; type Width; type Y; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type X = Unset; type Block = Unset; type Width = Unset; type Y = Unset; } ///State transition - sets the `x` field to Set pub struct SetX(PhantomData S>); impl sealed::Sealed for SetX {} impl State for SetX { type X = Set; type Block = S::Block; type Width = S::Width; type Y = S::Y; } ///State transition - sets the `block` field to Set pub struct SetBlock(PhantomData S>); impl sealed::Sealed for SetBlock {} impl State for SetBlock { type X = S::X; type Block = Set; type Width = S::Width; type Y = S::Y; } ///State transition - sets the `width` field to Set pub struct SetWidth(PhantomData S>); impl sealed::Sealed for SetWidth {} impl State for SetWidth { type X = S::X; type Block = S::Block; type Width = Set; type Y = S::Y; } ///State transition - sets the `y` field to Set pub struct SetY(PhantomData S>); impl sealed::Sealed for SetY {} impl State for SetY { type X = S::X; type Block = S::Block; type Width = S::Width; type Y = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `x` field pub struct x(()); ///Marker type for the `block` field pub struct block(()); ///Marker type for the `width` field pub struct width(()); ///Marker type for the `y` field pub struct y(()); } } /// Builder for constructing an instance of this type pub struct BlockBuilder<'a, S: block_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ::core::option::Option, ::core::option::Option, ::core::option::Option, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Block<'a> { /// Create a new builder for this type pub fn new() -> BlockBuilder<'a, block_state::Empty> { BlockBuilder::new() } } impl<'a> BlockBuilder<'a, block_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { BlockBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BlockBuilder<'a, S> where S: block_state::State, S::Block: block_state::IsUnset, { /// Set the `block` field (required) pub fn block( mut self, value: impl Into>, ) -> BlockBuilder<'a, block_state::SetBlock> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); BlockBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: block_state::State> BlockBuilder<'a, S> { /// Set the `height` field (optional) pub fn height(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `height` field to an Option value (optional) pub fn maybe_height(mut self, value: Option) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S: block_state::State> BlockBuilder<'a, S> { /// Set the `rotation` field (optional) pub fn rotation(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `rotation` field to an Option value (optional) pub fn maybe_rotation(mut self, value: Option) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S> BlockBuilder<'a, S> where S: block_state::State, S::Width: block_state::IsUnset, { /// Set the `width` field (required) pub fn width( mut self, value: impl Into, ) -> BlockBuilder<'a, block_state::SetWidth> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); BlockBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BlockBuilder<'a, S> where S: block_state::State, S::X: block_state::IsUnset, { /// Set the `x` field (required) pub fn x(mut self, value: impl Into) -> BlockBuilder<'a, block_state::SetX> { self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); BlockBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BlockBuilder<'a, S> where S: block_state::State, S::Y: block_state::IsUnset, { /// Set the `y` field (required) pub fn y(mut self, value: impl Into) -> BlockBuilder<'a, block_state::SetY> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); BlockBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BlockBuilder<'a, S> where S: block_state::State, S::X: block_state::IsSet, S::Block: block_state::IsSet, S::Width: block_state::IsSet, S::Y: block_state::IsSet, { /// Build the final struct pub fn build(self) -> Block<'a> { Block { block: self.__unsafe_private_named.0.unwrap(), height: self.__unsafe_private_named.1, rotation: self.__unsafe_private_named.2, width: self.__unsafe_private_named.3.unwrap(), x: self.__unsafe_private_named.4.unwrap(), y: self.__unsafe_private_named.5.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> Block<'a> { Block { block: self.__unsafe_private_named.0.unwrap(), height: self.__unsafe_private_named.1, rotation: self.__unsafe_private_named.2, width: self.__unsafe_private_named.3.unwrap(), x: self.__unsafe_private_named.4.unwrap(), y: self.__unsafe_private_named.5.unwrap(), extra_data: Some(extra_data), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(tag = "$type")] #[serde(bound(deserialize = "'de: 'a"))] pub enum BlockBlock<'a> { #[serde(rename = "pub.leaflet.blocks.iframe")] Iframe(Box>), #[serde(rename = "pub.leaflet.blocks.text")] Text(Box>), #[serde(rename = "pub.leaflet.blocks.blockquote")] Blockquote(Box>), #[serde(rename = "pub.leaflet.blocks.header")] Header(Box>), #[serde(rename = "pub.leaflet.blocks.image")] Image(Box>), #[serde(rename = "pub.leaflet.blocks.unorderedList")] UnorderedList(Box>), #[serde(rename = "pub.leaflet.blocks.website")] Website(Box>), #[serde(rename = "pub.leaflet.blocks.math")] Math(Box>), #[serde(rename = "pub.leaflet.blocks.code")] Code(Box>), #[serde(rename = "pub.leaflet.blocks.horizontalRule")] HorizontalRule(Box>), #[serde(rename = "pub.leaflet.blocks.bskyPost")] BskyPost(Box>), #[serde(rename = "pub.leaflet.blocks.page")] Page(Box>), #[serde(rename = "pub.leaflet.blocks.poll")] Poll(Box>), #[serde(rename = "pub.leaflet.blocks.button")] Button(Box>), } fn lexicon_doc_pub_leaflet_pages_canvas() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("pub.leaflet.pages.canvas"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_common::smol_str::SmolStr::new_static("x"), ::jacquard_common::smol_str::SmolStr::new_static("y"), ::jacquard_common::smol_str::SmolStr::new_static("width") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.iframe"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.text"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.blockquote"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.header"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.image"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.unorderedList"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.website"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.math"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.code"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.horizontalRule"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.bskyPost"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.page"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.poll"), ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.button") ], closed: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("rotation"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("width"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("x"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("y"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("blocks")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("blocks"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: None, items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#block"), }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("position"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_common::smol_str::SmolStr::new_static("offset") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("block"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: None, items: ::jacquard_lexicon::lexicon::LexArrayItem::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("offset"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("quote"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("start"), ::jacquard_common::smol_str::SmolStr::new_static("end") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("end"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#position"), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("start"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#position"), }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("textAlignCenter"), ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { description: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("textAlignLeft"), ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { description: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("textAlignRight"), ::jacquard_lexicon::lexicon::LexUserType::Token(::jacquard_lexicon::lexicon::LexToken { description: None, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Block<'a> { fn nsid() -> &'static str { "pub.leaflet.pages.canvas" } fn def_name() -> &'static str { "block" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_pages_canvas() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Canvas<'a> { #[serde(borrow)] pub blocks: Vec>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub id: std::option::Option>, } pub mod canvas_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Blocks; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Blocks = Unset; } ///State transition - sets the `blocks` field to Set pub struct SetBlocks(PhantomData S>); impl sealed::Sealed for SetBlocks {} impl State for SetBlocks { type Blocks = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `blocks` field pub struct blocks(()); } } /// Builder for constructing an instance of this type pub struct CanvasBuilder<'a, S: canvas_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Canvas<'a> { /// Create a new builder for this type pub fn new() -> CanvasBuilder<'a, canvas_state::Empty> { CanvasBuilder::new() } } impl<'a> CanvasBuilder<'a, canvas_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { CanvasBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CanvasBuilder<'a, S> where S: canvas_state::State, S::Blocks: canvas_state::IsUnset, { /// Set the `blocks` field (required) pub fn blocks( mut self, value: impl Into>>, ) -> CanvasBuilder<'a, canvas_state::SetBlocks> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); CanvasBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: canvas_state::State> CanvasBuilder<'a, S> { /// Set the `id` field (optional) pub fn id(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `id` field to an Option value (optional) pub fn maybe_id(mut self, value: Option>) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> CanvasBuilder<'a, S> where S: canvas_state::State, S::Blocks: canvas_state::IsSet, { /// Build the final struct pub fn build(self) -> Canvas<'a> { Canvas { blocks: self.__unsafe_private_named.0.unwrap(), id: self.__unsafe_private_named.1, extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> Canvas<'a> { Canvas { blocks: self.__unsafe_private_named.0.unwrap(), id: self.__unsafe_private_named.1, extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Canvas<'a> { fn nsid() -> &'static str { "pub.leaflet.pages.canvas" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_pages_canvas() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Position<'a> { pub block: Vec, pub offset: i64, } pub mod position_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Block; type Offset; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Block = Unset; type Offset = Unset; } ///State transition - sets the `block` field to Set pub struct SetBlock(PhantomData S>); impl sealed::Sealed for SetBlock {} impl State for SetBlock { type Block = Set; type Offset = S::Offset; } ///State transition - sets the `offset` field to Set pub struct SetOffset(PhantomData S>); impl sealed::Sealed for SetOffset {} impl State for SetOffset { type Block = S::Block; type Offset = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `block` field pub struct block(()); ///Marker type for the `offset` field pub struct offset(()); } } /// Builder for constructing an instance of this type pub struct PositionBuilder<'a, S: position_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Position<'a> { /// Create a new builder for this type pub fn new() -> PositionBuilder<'a, position_state::Empty> { PositionBuilder::new() } } impl<'a> PositionBuilder<'a, position_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { PositionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PositionBuilder<'a, S> where S: position_state::State, S::Block: position_state::IsUnset, { /// Set the `block` field (required) pub fn block( mut self, value: impl Into>, ) -> PositionBuilder<'a, position_state::SetBlock> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); PositionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PositionBuilder<'a, S> where S: position_state::State, S::Offset: position_state::IsUnset, { /// Set the `offset` field (required) pub fn offset( mut self, value: impl Into, ) -> PositionBuilder<'a, position_state::SetOffset> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); PositionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PositionBuilder<'a, S> where S: position_state::State, S::Block: position_state::IsSet, S::Offset: position_state::IsSet, { /// Build the final struct pub fn build(self) -> Position<'a> { Position { block: self.__unsafe_private_named.0.unwrap(), offset: self.__unsafe_private_named.1.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> Position<'a> { Position { block: self.__unsafe_private_named.0.unwrap(), offset: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Position<'a> { fn nsid() -> &'static str { "pub.leaflet.pages.canvas" } fn def_name() -> &'static str { "position" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_pages_canvas() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Quote<'a> { #[serde(borrow)] pub end: crate::pub_leaflet::pages::canvas::Position<'a>, #[serde(borrow)] pub start: crate::pub_leaflet::pages::canvas::Position<'a>, } pub mod quote_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type End; type Start; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type End = Unset; type Start = Unset; } ///State transition - sets the `end` field to Set pub struct SetEnd(PhantomData S>); impl sealed::Sealed for SetEnd {} impl State for SetEnd { type End = Set; type Start = S::Start; } ///State transition - sets the `start` field to Set pub struct SetStart(PhantomData S>); impl sealed::Sealed for SetStart {} impl State for SetStart { type End = S::End; type Start = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `end` field pub struct end(()); ///Marker type for the `start` field pub struct start(()); } } /// Builder for constructing an instance of this type pub struct QuoteBuilder<'a, S: quote_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Quote<'a> { /// Create a new builder for this type pub fn new() -> QuoteBuilder<'a, quote_state::Empty> { QuoteBuilder::new() } } impl<'a> QuoteBuilder<'a, quote_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { QuoteBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> QuoteBuilder<'a, S> where S: quote_state::State, S::End: quote_state::IsUnset, { /// Set the `end` field (required) pub fn end( mut self, value: impl Into>, ) -> QuoteBuilder<'a, quote_state::SetEnd> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); QuoteBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> QuoteBuilder<'a, S> where S: quote_state::State, S::Start: quote_state::IsUnset, { /// Set the `start` field (required) pub fn start( mut self, value: impl Into>, ) -> QuoteBuilder<'a, quote_state::SetStart> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); QuoteBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> QuoteBuilder<'a, S> where S: quote_state::State, S::End: quote_state::IsSet, S::Start: quote_state::IsSet, { /// Build the final struct pub fn build(self) -> Quote<'a> { Quote { end: self.__unsafe_private_named.0.unwrap(), start: self.__unsafe_private_named.1.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> Quote<'a> { Quote { end: self.__unsafe_private_named.0.unwrap(), start: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Quote<'a> { fn nsid() -> &'static str { "pub.leaflet.pages.canvas" } fn def_name() -> &'static str { "quote" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_pages_canvas() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Hash, jacquard_derive::IntoStatic )] pub struct TextAlignCenter; impl std::fmt::Display for TextAlignCenter { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "textAlignCenter") } } #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Hash, jacquard_derive::IntoStatic )] pub struct TextAlignLeft; impl std::fmt::Display for TextAlignLeft { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "textAlignLeft") } } #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Hash, jacquard_derive::IntoStatic )] pub struct TextAlignRight; impl std::fmt::Display for TextAlignRight { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "textAlignRight") } }