// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: app.bsky.embed.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. pub mod external; pub mod images; pub mod record; pub mod record_with_media; pub mod video; /// width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct AspectRatio<'a> { pub height: i64, pub width: i64, } pub mod aspect_ratio_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 Height; type Width; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Height = Unset; type Width = Unset; } ///State transition - sets the `height` field to Set pub struct SetHeight(PhantomData S>); impl sealed::Sealed for SetHeight {} impl State for SetHeight { type Height = Set; type Width = S::Width; } ///State transition - sets the `width` field to Set pub struct SetWidth(PhantomData S>); impl sealed::Sealed for SetWidth {} impl State for SetWidth { type Height = S::Height; type Width = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `height` field pub struct height(()); ///Marker type for the `width` field pub struct width(()); } } /// Builder for constructing an instance of this type pub struct AspectRatioBuilder<'a, S: aspect_ratio_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: (::core::option::Option, ::core::option::Option), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> AspectRatio<'a> { /// Create a new builder for this type pub fn new() -> AspectRatioBuilder<'a, aspect_ratio_state::Empty> { AspectRatioBuilder::new() } } impl<'a> AspectRatioBuilder<'a, aspect_ratio_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { AspectRatioBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> AspectRatioBuilder<'a, S> where S: aspect_ratio_state::State, S::Height: aspect_ratio_state::IsUnset, { /// Set the `height` field (required) pub fn height( mut self, value: impl Into, ) -> AspectRatioBuilder<'a, aspect_ratio_state::SetHeight> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); AspectRatioBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> AspectRatioBuilder<'a, S> where S: aspect_ratio_state::State, S::Width: aspect_ratio_state::IsUnset, { /// Set the `width` field (required) pub fn width( mut self, value: impl Into, ) -> AspectRatioBuilder<'a, aspect_ratio_state::SetWidth> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); AspectRatioBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> AspectRatioBuilder<'a, S> where S: aspect_ratio_state::State, S::Height: aspect_ratio_state::IsSet, S::Width: aspect_ratio_state::IsSet, { /// Build the final struct pub fn build(self) -> AspectRatio<'a> { AspectRatio { height: self.__unsafe_private_named.0.unwrap(), width: 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>, >, ) -> AspectRatio<'a> { AspectRatio { height: self.__unsafe_private_named.0.unwrap(), width: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_app_bsky_embed_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("app.bsky.embed.defs"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("aspectRatio"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("width"), ::jacquard_common::smol_str::SmolStr::new_static("height") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("height"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: Some(1i64), 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: Some(1i64), maximum: None, r#enum: None, r#const: None, }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AspectRatio<'a> { fn nsid() -> &'static str { "app.bsky.embed.defs" } fn def_name() -> &'static str { "aspectRatio" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_app_bsky_embed_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.height; if *value < 1i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "height", ), min: 1i64, actual: *value, }); } } { let value = &self.width; if *value < 1i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "width", ), min: 1i64, actual: *value, }); } } Ok(()) } }