// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: pub.leaflet.theme.backgroundImage // // 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 BackgroundImage<'a> { #[serde(borrow)] pub image: jacquard_common::types::blob::BlobRef<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub repeat: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub width: std::option::Option, } pub mod background_image_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 Image; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Image = Unset; } ///State transition - sets the `image` field to Set pub struct SetImage(PhantomData S>); impl sealed::Sealed for SetImage {} impl State for SetImage { type Image = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `image` field pub struct image(()); } } /// Builder for constructing an instance of this type pub struct BackgroundImageBuilder<'a, S: background_image_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> BackgroundImage<'a> { /// Create a new builder for this type pub fn new() -> BackgroundImageBuilder<'a, background_image_state::Empty> { BackgroundImageBuilder::new() } } impl<'a> BackgroundImageBuilder<'a, background_image_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { BackgroundImageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> BackgroundImageBuilder<'a, S> where S: background_image_state::State, S::Image: background_image_state::IsUnset, { /// Set the `image` field (required) pub fn image( mut self, value: impl Into>, ) -> BackgroundImageBuilder<'a, background_image_state::SetImage> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); BackgroundImageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: background_image_state::State> BackgroundImageBuilder<'a, S> { /// Set the `repeat` field (optional) pub fn repeat(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `repeat` field to an Option value (optional) pub fn maybe_repeat(mut self, value: Option) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S: background_image_state::State> BackgroundImageBuilder<'a, S> { /// Set the `width` field (optional) pub fn width(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `width` field to an Option value (optional) pub fn maybe_width(mut self, value: Option) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S> BackgroundImageBuilder<'a, S> where S: background_image_state::State, S::Image: background_image_state::IsSet, { /// Build the final struct pub fn build(self) -> BackgroundImage<'a> { BackgroundImage { image: self.__unsafe_private_named.0.unwrap(), repeat: self.__unsafe_private_named.1, width: self.__unsafe_private_named.2, 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>, >, ) -> BackgroundImage<'a> { BackgroundImage { image: self.__unsafe_private_named.0.unwrap(), repeat: self.__unsafe_private_named.1, width: self.__unsafe_private_named.2, extra_data: Some(extra_data), } } } fn lexicon_doc_pub_leaflet_theme_backgroundImage() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("pub.leaflet.theme.backgroundImage"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); 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("image")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("image"), ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { description: None, accept: None, max_size: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("repeat"), ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { description: None, default: 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 }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for BackgroundImage<'a> { fn nsid() -> &'static str { "pub.leaflet.theme.backgroundImage" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_theme_backgroundImage() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }