// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.weaver.embed.images // // 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 Image<'a> { /// alt text description of the image #[serde(borrow)] pub alt: jacquard_common::CowStr<'a>, /// Blurhash string for the image, used for low-resolution placeholders. This must be a valid Blurhash string. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub blurhash: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub dimensions: std::option::Option>, #[serde(borrow)] pub image: jacquard_common::types::blob::BlobRef<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub name: std::option::Option>, } pub mod 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 Alt; type Image; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Alt = Unset; type Image = Unset; } ///State transition - sets the `alt` field to Set pub struct SetAlt(PhantomData S>); impl sealed::Sealed for SetAlt {} impl State for SetAlt { type Alt = Set; type Image = S::Image; } ///State transition - sets the `image` field to Set pub struct SetImage(PhantomData S>); impl sealed::Sealed for SetImage {} impl State for SetImage { type Alt = S::Alt; type Image = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `alt` field pub struct alt(()); ///Marker type for the `image` field pub struct image(()); } } /// Builder for constructing an instance of this type pub struct ImageBuilder<'a, S: image_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>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Image<'a> { /// Create a new builder for this type pub fn new() -> ImageBuilder<'a, image_state::Empty> { ImageBuilder::new() } } impl<'a> ImageBuilder<'a, image_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ImageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ImageBuilder<'a, S> where S: image_state::State, S::Alt: image_state::IsUnset, { /// Set the `alt` field (required) pub fn alt( mut self, value: impl Into>, ) -> ImageBuilder<'a, image_state::SetAlt> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ImageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: image_state::State> ImageBuilder<'a, S> { /// Set the `blurhash` field (optional) pub fn blurhash( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `blurhash` field to an Option value (optional) pub fn maybe_blurhash(mut self, value: Option>) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S: image_state::State> ImageBuilder<'a, S> { /// Set the `dimensions` field (optional) pub fn dimensions(mut self, value: impl Into>>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `dimensions` field to an Option value (optional) pub fn maybe_dimensions(mut self, value: Option>) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S> ImageBuilder<'a, S> where S: image_state::State, S::Image: image_state::IsUnset, { /// Set the `image` field (required) pub fn image( mut self, value: impl Into>, ) -> ImageBuilder<'a, image_state::SetImage> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); ImageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: image_state::State> ImageBuilder<'a, S> { /// Set the `name` field (optional) pub fn name( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `name` field to an Option value (optional) pub fn maybe_name(mut self, value: Option>) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S> ImageBuilder<'a, S> where S: image_state::State, S::Alt: image_state::IsSet, S::Image: image_state::IsSet, { /// Build the final struct pub fn build(self) -> Image<'a> { Image { alt: self.__unsafe_private_named.0.unwrap(), blurhash: self.__unsafe_private_named.1, dimensions: self.__unsafe_private_named.2, image: self.__unsafe_private_named.3.unwrap(), name: self.__unsafe_private_named.4, 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>, >, ) -> Image<'a> { Image { alt: self.__unsafe_private_named.0.unwrap(), blurhash: self.__unsafe_private_named.1, dimensions: self.__unsafe_private_named.2, image: self.__unsafe_private_named.3.unwrap(), name: self.__unsafe_private_named.4, 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 ImageDimensions<'a> { #[serde(rename = "app.bsky.embed.defs#aspectRatio")] AspectRatio(Box>), #[serde(rename = "sh.weaver.embed.defs#percentSize")] PercentSize(Box>), #[serde(rename = "sh.weaver.embed.defs#pixelSize")] PixelSize(Box>), } fn lexicon_doc_sh_weaver_embed_images() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("sh.weaver.embed.images"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("image"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("image"), ::jacquard_common::smol_str::SmolStr::new_static("alt") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "alt text description of the image", ), ), 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.insert( ::jacquard_common::smol_str::SmolStr::new_static("blurhash"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Blurhash string for the image, used for low-resolution placeholders. This must be a valid Blurhash string.", ), ), format: None, default: None, min_length: None, max_length: Some(32usize), min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "dimensions", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("app.bsky.embed.defs#aspectRatio"), ::jacquard_common::CowStr::new_static("sh.weaver.embed.defs#percentSize"), ::jacquard_common::CowStr::new_static("sh.weaver.embed.defs#pixelSize") ], closed: None, }), ); 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("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: Some(128usize), 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("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("images")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("images"), ::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("#image"), }), min_length: None, max_length: Some(48usize), }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("view"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("images")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("images"), ::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("#viewImage"), }), min_length: None, max_length: Some(48usize), }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("viewImage"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("thumb"), ::jacquard_common::smol_str::SmolStr::new_static("fullsize"), ::jacquard_common::smol_str::SmolStr::new_static("alt") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("alt"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Alt text description of the image, for accessibility.", ), ), 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.insert( ::jacquard_common::smol_str::SmolStr::new_static( "dimensions", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("app.bsky.embed.defs#aspectRatio"), ::jacquard_common::CowStr::new_static("sh.weaver.embed.defs#percentSize"), ::jacquard_common::CowStr::new_static("sh.weaver.embed.defs#pixelSize") ], closed: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("fullsize"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View.", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Uri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: Some(128usize), min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("thumb"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View.", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Uri, ), 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 }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Image<'a> { fn nsid() -> &'static str { "sh.weaver.embed.images" } fn def_name() -> &'static str { "image" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_embed_images() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.blurhash { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 32usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "blurhash", ), max: 32usize, actual: ::len(value.as_ref()), }); } } if let Some(ref value) = self.name { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 128usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "name", ), max: 128usize, actual: ::len(value.as_ref()), }); } } Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Images<'a> { #[serde(borrow)] pub images: Vec>, } pub mod images_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 Images; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Images = Unset; } ///State transition - sets the `images` field to Set pub struct SetImages(PhantomData S>); impl sealed::Sealed for SetImages {} impl State for SetImages { type Images = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `images` field pub struct images(()); } } /// Builder for constructing an instance of this type pub struct ImagesBuilder<'a, S: images_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Images<'a> { /// Create a new builder for this type pub fn new() -> ImagesBuilder<'a, images_state::Empty> { ImagesBuilder::new() } } impl<'a> ImagesBuilder<'a, images_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ImagesBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ImagesBuilder<'a, S> where S: images_state::State, S::Images: images_state::IsUnset, { /// Set the `images` field (required) pub fn images( mut self, value: impl Into>>, ) -> ImagesBuilder<'a, images_state::SetImages> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ImagesBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ImagesBuilder<'a, S> where S: images_state::State, S::Images: images_state::IsSet, { /// Build the final struct pub fn build(self) -> Images<'a> { Images { images: self.__unsafe_private_named.0.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>, >, ) -> Images<'a> { Images { images: self.__unsafe_private_named.0.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Images<'a> { fn nsid() -> &'static str { "sh.weaver.embed.images" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_embed_images() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.images; #[allow(unused_comparisons)] if value.len() > 48usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "images", ), max: 48usize, actual: value.len(), }); } } Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct View<'a> { #[serde(borrow)] pub images: Vec>, } pub mod view_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 Images; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Images = Unset; } ///State transition - sets the `images` field to Set pub struct SetImages(PhantomData S>); impl sealed::Sealed for SetImages {} impl State for SetImages { type Images = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `images` field pub struct images(()); } } /// Builder for constructing an instance of this type pub struct ViewBuilder<'a, S: view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> View<'a> { /// Create a new builder for this type pub fn new() -> ViewBuilder<'a, view_state::Empty> { ViewBuilder::new() } } impl<'a> ViewBuilder<'a, view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ViewBuilder<'a, S> where S: view_state::State, S::Images: view_state::IsUnset, { /// Set the `images` field (required) pub fn images( mut self, value: impl Into>>, ) -> ViewBuilder<'a, view_state::SetImages> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ViewBuilder<'a, S> where S: view_state::State, S::Images: view_state::IsSet, { /// Build the final struct pub fn build(self) -> View<'a> { View { images: self.__unsafe_private_named.0.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>, >, ) -> View<'a> { View { images: self.__unsafe_private_named.0.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> { fn nsid() -> &'static str { "sh.weaver.embed.images" } fn def_name() -> &'static str { "view" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_embed_images() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.images; #[allow(unused_comparisons)] if value.len() > 48usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "images", ), max: 48usize, actual: value.len(), }); } } Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ViewImage<'a> { /// Alt text description of the image, for accessibility. #[serde(borrow)] pub alt: jacquard_common::CowStr<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub dimensions: std::option::Option>, /// Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. #[serde(borrow)] pub fullsize: jacquard_common::types::string::Uri<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub name: std::option::Option>, /// Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. #[serde(borrow)] pub thumb: jacquard_common::types::string::Uri<'a>, } pub mod view_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 Fullsize; type Thumb; type Alt; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Fullsize = Unset; type Thumb = Unset; type Alt = Unset; } ///State transition - sets the `fullsize` field to Set pub struct SetFullsize(PhantomData S>); impl sealed::Sealed for SetFullsize {} impl State for SetFullsize { type Fullsize = Set; type Thumb = S::Thumb; type Alt = S::Alt; } ///State transition - sets the `thumb` field to Set pub struct SetThumb(PhantomData S>); impl sealed::Sealed for SetThumb {} impl State for SetThumb { type Fullsize = S::Fullsize; type Thumb = Set; type Alt = S::Alt; } ///State transition - sets the `alt` field to Set pub struct SetAlt(PhantomData S>); impl sealed::Sealed for SetAlt {} impl State for SetAlt { type Fullsize = S::Fullsize; type Thumb = S::Thumb; type Alt = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `fullsize` field pub struct fullsize(()); ///Marker type for the `thumb` field pub struct thumb(()); ///Marker type for the `alt` field pub struct alt(()); } } /// Builder for constructing an instance of this type pub struct ViewImageBuilder<'a, S: view_image_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>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ViewImage<'a> { /// Create a new builder for this type pub fn new() -> ViewImageBuilder<'a, view_image_state::Empty> { ViewImageBuilder::new() } } impl<'a> ViewImageBuilder<'a, view_image_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ViewImageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ViewImageBuilder<'a, S> where S: view_image_state::State, S::Alt: view_image_state::IsUnset, { /// Set the `alt` field (required) pub fn alt( mut self, value: impl Into>, ) -> ViewImageBuilder<'a, view_image_state::SetAlt> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ViewImageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: view_image_state::State> ViewImageBuilder<'a, S> { /// Set the `dimensions` field (optional) pub fn dimensions( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `dimensions` field to an Option value (optional) pub fn maybe_dimensions(mut self, value: Option>) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S> ViewImageBuilder<'a, S> where S: view_image_state::State, S::Fullsize: view_image_state::IsUnset, { /// Set the `fullsize` field (required) pub fn fullsize( mut self, value: impl Into>, ) -> ViewImageBuilder<'a, view_image_state::SetFullsize> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); ViewImageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: view_image_state::State> ViewImageBuilder<'a, S> { /// Set the `name` field (optional) pub fn name( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `name` field to an Option value (optional) pub fn maybe_name(mut self, value: Option>) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S> ViewImageBuilder<'a, S> where S: view_image_state::State, S::Thumb: view_image_state::IsUnset, { /// Set the `thumb` field (required) pub fn thumb( mut self, value: impl Into>, ) -> ViewImageBuilder<'a, view_image_state::SetThumb> { self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); ViewImageBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ViewImageBuilder<'a, S> where S: view_image_state::State, S::Fullsize: view_image_state::IsSet, S::Thumb: view_image_state::IsSet, S::Alt: view_image_state::IsSet, { /// Build the final struct pub fn build(self) -> ViewImage<'a> { ViewImage { alt: self.__unsafe_private_named.0.unwrap(), dimensions: self.__unsafe_private_named.1, fullsize: self.__unsafe_private_named.2.unwrap(), name: self.__unsafe_private_named.3, thumb: self.__unsafe_private_named.4.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>, >, ) -> ViewImage<'a> { ViewImage { alt: self.__unsafe_private_named.0.unwrap(), dimensions: self.__unsafe_private_named.1, fullsize: self.__unsafe_private_named.2.unwrap(), name: self.__unsafe_private_named.3, thumb: self.__unsafe_private_named.4.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 ViewImageDimensions<'a> { #[serde(rename = "app.bsky.embed.defs#aspectRatio")] AspectRatio(Box>), #[serde(rename = "sh.weaver.embed.defs#percentSize")] PercentSize(Box>), #[serde(rename = "sh.weaver.embed.defs#pixelSize")] PixelSize(Box>), } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewImage<'a> { fn nsid() -> &'static str { "sh.weaver.embed.images" } fn def_name() -> &'static str { "viewImage" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_embed_images() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { if let Some(ref value) = self.name { #[allow(unused_comparisons)] if ::len(value.as_ref()) > 128usize { return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "name", ), max: 128usize, actual: ::len(value.as_ref()), }); } } Ok(()) } }