pub mod content;
pub mod post;
pub mod tag;
#[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 {}
}
pub trait State: sealed::Sealed {
type Height;
type Width;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Height = Unset;
type Width = Unset;
}
pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHeight<S> {}
impl<S: State> State for SetHeight<S> {
type Height = Set<members::height>;
type Width = S::Width;
}
pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetWidth<S> {}
impl<S: State> State for SetWidth<S> {
type Height = S::Height;
type Width = Set<members::width>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct height(());
pub struct width(());
}
}
pub struct AspectRatioBuilder<'a, S: aspect_ratio_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (::core::option::Option<i64>, ::core::option::Option<i64>),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> AspectRatio<'a> {
pub fn new() -> AspectRatioBuilder<'a, aspect_ratio_state::Empty> {
AspectRatioBuilder::new()
}
}
impl<'a> AspectRatioBuilder<'a, aspect_ratio_state::Empty> {
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,
{
pub fn height(
mut self,
value: impl Into<i64>,
) -> AspectRatioBuilder<'a, aspect_ratio_state::SetHeight<S>> {
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,
{
pub fn width(
mut self,
value: impl Into<i64>,
) -> AspectRatioBuilder<'a, aspect_ratio_state::SetWidth<S>> {
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,
{
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(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::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_us_polhem_blog_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("us.polhem.blog.defs"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::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::deps::smol_str::SmolStr::new_static("width"),
::jacquard_common::deps::smol_str::SmolStr::new_static("height")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::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::deps::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 {
"us.polhem.blog.defs"
}
fn def_name() -> &'static str {
"aspectRatio"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_us_polhem_blog_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(())
}
}