#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Image<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub alt: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub image: jacquard_common::types::blob::BlobRef<'a>,
}
pub mod image_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 Image;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Image = Unset;
}
pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetImage<S> {}
impl<S: State> State for SetImage<S> {
type Image = Set<members::image>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct image(());
}
}
pub struct ImageBuilder<'a, S: image_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Image<'a> {
pub fn new() -> ImageBuilder<'a, image_state::Empty> {
ImageBuilder::new()
}
}
impl<'a> ImageBuilder<'a, image_state::Empty> {
pub fn new() -> Self {
ImageBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: image_state::State> ImageBuilder<'a, S> {
pub fn alt(mut self, value: impl Into<Option<jacquard_common::CowStr<'a>>>) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_alt(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S> ImageBuilder<'a, S>
where
S: image_state::State,
S::Image: image_state::IsUnset,
{
pub fn image(
mut self,
value: impl Into<jacquard_common::types::blob::BlobRef<'a>>,
) -> ImageBuilder<'a, image_state::SetImage<S>> {
self.__unsafe_private_named.1 = ::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> ImageBuilder<'a, S>
where
S: image_state::State,
S::Image: image_state::IsSet,
{
pub fn build(self) -> Image<'a> {
Image {
alt: self.__unsafe_private_named.0,
image: 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>,
>,
) -> Image<'a> {
Image {
alt: self.__unsafe_private_named.0,
image: self.__unsafe_private_named.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_space_litenote_note() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("space.litenote.note"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("image"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("image")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"alt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Alt text for the image.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(2000usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"image",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob {
description: None,
accept: None,
max_size: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
description: Some(
::jacquard_common::CowStr::new_static(
"A markdown blog post with LaTeX, GitHub notes, Mermaid, YouTube and Bluesky extensions.",
),
),
key: Some(::jacquard_common::CowStr::new_static("tid")),
record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("title"),
::jacquard_common::deps::smol_str::SmolStr::new_static("content")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"content",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Markdown content. Local image paths are replaced with blob CIDs at publish time.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(10000usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
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::deps::smol_str::SmolStr::new_static(
"fontFamily",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Font family name available from Coollabs.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(200usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"fontSize",
),
::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::deps::smol_str::SmolStr::new_static(
"images",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Blob references for images embedded in the markdown content.",
),
),
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(20usize),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"publishedAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
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::deps::smol_str::SmolStr::new_static(
"theme",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Display theme for the note.",
),
),
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::deps::smol_str::SmolStr::new_static(
"title",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: Some(1000usize),
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 {
"space.litenote.note"
}
fn def_name() -> &'static str {
"image"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_space_litenote_note()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.alt {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 2000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"alt",
),
max: 2000usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.image;
{
let size = value.blob().size;
if size > 2000000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::BlobTooLarge {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"image",
),
max: 2000000usize,
actual: size,
});
}
}
}
{
let value = &self.image;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["image/*"];
let matched = accepted
.iter()
.any(|pattern| {
if *pattern == "*/*" {
true
} else if pattern.ends_with("/*") {
let prefix = &pattern[..pattern.len() - 2];
mime.starts_with(prefix)
&& mime.as_bytes().get(prefix.len()) == Some(&b'/')
} else {
mime == *pattern
}
});
if !matched {
return Err(::jacquard_lexicon::validation::ConstraintError::BlobMimeTypeNotAccepted {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"image",
),
accepted: vec!["image/*".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Note<'a> {
#[serde(borrow)]
pub content: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub created_at: std::option::Option<jacquard_common::types::string::Datetime>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub font_family: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub font_size: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub images: std::option::Option<Vec<crate::space_litenote::note::Image<'a>>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub published_at: std::option::Option<jacquard_common::types::string::Datetime>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub theme: std::option::Option<NoteTheme<'a>>,
#[serde(borrow)]
pub title: jacquard_common::CowStr<'a>,
}
pub mod note_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 Title;
type Content;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Title = Unset;
type Content = Unset;
}
pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetTitle<S> {}
impl<S: State> State for SetTitle<S> {
type Title = Set<members::title>;
type Content = S::Content;
}
pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetContent<S> {}
impl<S: State> State for SetContent<S> {
type Title = S::Title;
type Content = Set<members::content>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct title(());
pub struct content(());
}
}
pub struct NoteBuilder<'a, S: note_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<i64>,
::core::option::Option<Vec<crate::space_litenote::note::Image<'a>>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<NoteTheme<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Note<'a> {
pub fn new() -> NoteBuilder<'a, note_state::Empty> {
NoteBuilder::new()
}
}
impl<'a> NoteBuilder<'a, note_state::Empty> {
pub fn new() -> Self {
NoteBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None, None, None, None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> NoteBuilder<'a, S>
where
S: note_state::State,
S::Content: note_state::IsUnset,
{
pub fn content(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> NoteBuilder<'a, note_state::SetContent<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
NoteBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: note_state::State> NoteBuilder<'a, S> {
pub fn created_at(
mut self,
value: impl Into<Option<jacquard_common::types::string::Datetime>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_created_at(
mut self,
value: Option<jacquard_common::types::string::Datetime>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S: note_state::State> NoteBuilder<'a, S> {
pub fn font_family(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_font_family(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S: note_state::State> NoteBuilder<'a, S> {
pub fn font_size(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_font_size(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S: note_state::State> NoteBuilder<'a, S> {
pub fn images(
mut self,
value: impl Into<Option<Vec<crate::space_litenote::note::Image<'a>>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_images(
mut self,
value: Option<Vec<crate::space_litenote::note::Image<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S: note_state::State> NoteBuilder<'a, S> {
pub fn published_at(
mut self,
value: impl Into<Option<jacquard_common::types::string::Datetime>>,
) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_published_at(
mut self,
value: Option<jacquard_common::types::string::Datetime>,
) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S: note_state::State> NoteBuilder<'a, S> {
pub fn theme(mut self, value: impl Into<Option<NoteTheme<'a>>>) -> Self {
self.__unsafe_private_named.6 = value.into();
self
}
pub fn maybe_theme(mut self, value: Option<NoteTheme<'a>>) -> Self {
self.__unsafe_private_named.6 = value;
self
}
}
impl<'a, S> NoteBuilder<'a, S>
where
S: note_state::State,
S::Title: note_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> NoteBuilder<'a, note_state::SetTitle<S>> {
self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into());
NoteBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> NoteBuilder<'a, S>
where
S: note_state::State,
S::Title: note_state::IsSet,
S::Content: note_state::IsSet,
{
pub fn build(self) -> Note<'a> {
Note {
content: self.__unsafe_private_named.0.unwrap(),
created_at: self.__unsafe_private_named.1,
font_family: self.__unsafe_private_named.2,
font_size: self.__unsafe_private_named.3,
images: self.__unsafe_private_named.4,
published_at: self.__unsafe_private_named.5,
theme: self.__unsafe_private_named.6,
title: self.__unsafe_private_named.7.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>,
>,
) -> Note<'a> {
Note {
content: self.__unsafe_private_named.0.unwrap(),
created_at: self.__unsafe_private_named.1,
font_family: self.__unsafe_private_named.2,
font_size: self.__unsafe_private_named.3,
images: self.__unsafe_private_named.4,
published_at: self.__unsafe_private_named.5,
theme: self.__unsafe_private_named.6,
title: self.__unsafe_private_named.7.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> Note<'a> {
pub fn uri(
uri: impl Into<jacquard_common::CowStr<'a>>,
) -> Result<
jacquard_common::types::uri::RecordUri<'a, NoteRecord>,
jacquard_common::types::uri::UriError,
> {
jacquard_common::types::uri::RecordUri::try_from_uri(
jacquard_common::types::string::AtUri::new_cow(uri.into())?,
)
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum NoteTheme<'a> {
Light,
Dark,
Other(jacquard_common::CowStr<'a>),
}
impl<'a> NoteTheme<'a> {
pub fn as_str(&self) -> &str {
match self {
Self::Light => "light",
Self::Dark => "dark",
Self::Other(s) => s.as_ref(),
}
}
}
impl<'a> From<&'a str> for NoteTheme<'a> {
fn from(s: &'a str) -> Self {
match s {
"light" => Self::Light,
"dark" => Self::Dark,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> From<String> for NoteTheme<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"light" => Self::Light,
"dark" => Self::Dark,
_ => Self::Other(jacquard_common::CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for NoteTheme<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for NoteTheme<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for NoteTheme<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for NoteTheme<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for NoteTheme<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for NoteTheme<'_> {
type Output = NoteTheme<'static>;
fn into_static(self) -> Self::Output {
match self {
NoteTheme::Light => NoteTheme::Light,
NoteTheme::Dark => NoteTheme::Dark,
NoteTheme::Other(v) => NoteTheme::Other(v.into_static()),
}
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct NoteGetRecordOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
#[serde(borrow)]
pub uri: jacquard_common::types::string::AtUri<'a>,
#[serde(borrow)]
pub value: Note<'a>,
}
impl From<NoteGetRecordOutput<'_>> for Note<'_> {
fn from(output: NoteGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl jacquard_common::types::collection::Collection for Note<'_> {
const NSID: &'static str = "space.litenote.note";
type Record = NoteRecord;
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct NoteRecord;
impl jacquard_common::xrpc::XrpcResp for NoteRecord {
const NSID: &'static str = "space.litenote.note";
const ENCODING: &'static str = "application/json";
type Output<'de> = NoteGetRecordOutput<'de>;
type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}
impl jacquard_common::types::collection::Collection for NoteRecord {
const NSID: &'static str = "space.litenote.note";
type Record = NoteRecord;
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Note<'a> {
fn nsid() -> &'static str {
"space.litenote.note"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_space_litenote_note()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.content;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"content",
),
max: 10000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.font_family {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 200usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"font_family",
),
max: 200usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.images {
#[allow(unused_comparisons)]
if value.len() > 20usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"images",
),
max: 20usize,
actual: value.len(),
});
}
}
{
let value = &self.title;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 1000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"title",
),
max: 1000usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}