#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::blob::BlobRef;
use jacquard_common::types::string::{Did, UriValue};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
use crate::games_gamesgamesgamesgames::richtext::facet;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Bold<S: BosStr = DefaultStr> {
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ByteSlice<S: BosStr = DefaultStr> {
pub byte_end: i64,
pub byte_start: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Heading<S: BosStr = DefaultStr> {
pub level: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Image<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub alt: Option<S>,
pub blob: BlobRef<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Italic<S: BosStr = DefaultStr> {
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Link<S: BosStr = DefaultStr> {
pub uri: UriValue<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ListItem<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_list_item_depth")]
pub depth: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ordered: Option<bool>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Facet<S: BosStr = DefaultStr> {
pub features: Vec<FacetFeaturesItem<S>>,
pub index: facet::ByteSlice<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum FacetFeaturesItem<S: BosStr = DefaultStr> {
#[serde(rename = "games.gamesgamesgamesgames.richtext.facet#mention")]
Mention(Box<facet::Mention<S>>),
#[serde(rename = "games.gamesgamesgamesgames.richtext.facet#link")]
Link(Box<facet::Link<S>>),
#[serde(rename = "games.gamesgamesgamesgames.richtext.facet#tag")]
Tag(Box<facet::Tag<S>>),
#[serde(rename = "games.gamesgamesgamesgames.richtext.facet#bold")]
Bold(Box<facet::Bold<S>>),
#[serde(rename = "games.gamesgamesgamesgames.richtext.facet#italic")]
Italic(Box<facet::Italic<S>>),
#[serde(rename = "games.gamesgamesgamesgames.richtext.facet#heading")]
Heading(Box<facet::Heading<S>>),
#[serde(rename = "games.gamesgamesgamesgames.richtext.facet#listItem")]
ListItem(Box<facet::ListItem<S>>),
#[serde(rename = "games.gamesgamesgamesgames.richtext.facet#image")]
Image(Box<facet::Image<S>>),
#[serde(rename = "games.gamesgamesgamesgames.richtext.facet#video")]
Video(Box<facet::Video<S>>),
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Mention<S: BosStr = DefaultStr> {
pub did: Did<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Tag<S: BosStr = DefaultStr> {
pub tag: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Video<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub alt: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub blob: Option<BlobRef<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub uri: Option<UriValue<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for Bold<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"bold"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ByteSlice<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"byteSlice"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.byte_end;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("byte_end"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.byte_start;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("byte_start"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Heading<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"heading"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.level;
if *value > 6i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("level"),
max: 6i64,
actual: *value,
});
}
}
{
let value = &self.level;
if *value < 1i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("level"),
min: 1i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Image<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"image"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.blob;
{
let size = value.blob().size;
if size > 10000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("blob"),
max: 10000000usize,
actual: size,
});
}
}
}
{
let value = &self.blob;
{
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(ConstraintError::BlobMimeTypeNotAccepted {
path: ValidationPath::from_field("blob"),
accepted: vec!["image/*".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Italic<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"italic"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Link<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"link"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ListItem<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"listItem"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.depth {
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("depth"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Facet<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Mention<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"mention"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Tag<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"tag"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.tag;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 640usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("tag"),
max: 640usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.tag;
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 64usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("tag"),
max: 64usize,
actual: count,
});
}
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Video<S> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.richtext.facet"
}
fn def_name() -> &'static str {
"video"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_richtext_facet()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.blob {
{
let size = value.blob().size;
if size > 200000000usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("blob"),
max: 200000000usize,
actual: size,
});
}
}
}
if let Some(ref value) = self.blob {
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["video/*"];
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(ConstraintError::BlobMimeTypeNotAccepted {
path: ValidationPath::from_field("blob"),
accepted: vec!["video/*".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
fn lexicon_doc_games_gamesgamesgamesgames_richtext_facet() -> LexiconDoc<'static> {
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("games.gamesgamesgamesgames.richtext.facet"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("bold"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Facet feature for bold text.")),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("byteSlice"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text.",
),
),
required: Some(
vec![
SmolStr::new_static("byteStart"),
SmolStr::new_static("byteEnd")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("byteEnd"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("byteStart"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("heading"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Facet feature for a section heading.")),
required: Some(vec![SmolStr::new_static("level")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("level"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1i64),
maximum: Some(6i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("image"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Facet feature for an inline image.")),
required: Some(vec![SmolStr::new_static("blob")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("alt"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("blob"),
LexObjectProperty::Blob(LexBlob {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("height"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("width"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("italic"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Facet feature for italic text.")),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("link"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Facet feature for a URL.")),
required: Some(vec![SmolStr::new_static("uri")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("listItem"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Facet feature marking text as a list item.",
)),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("depth"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("ordered"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Annotation of a sub-string within rich text.",
)),
required: Some(vec![
SmolStr::new_static("index"),
SmolStr::new_static("features"),
]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("features"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#mention"),
CowStr::new_static("#link"),
CowStr::new_static("#tag"),
CowStr::new_static("#bold"),
CowStr::new_static("#italic"),
CowStr::new_static("#heading"),
CowStr::new_static("#listItem"),
CowStr::new_static("#image"),
CowStr::new_static("#video"),
],
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("index"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#byteSlice"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("mention"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Facet feature for mention of another account.",
)),
required: Some(vec![SmolStr::new_static("did")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("did"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Did),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tag"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Facet feature for a hashtag.")),
required: Some(vec![SmolStr::new_static("tag")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("tag"),
LexObjectProperty::String(LexString {
max_length: Some(640usize),
max_graphemes: Some(64usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("video"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Facet feature for an inline video.")),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("alt"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("blob"),
LexObjectProperty::Blob(LexBlob {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod byte_slice_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type ByteStart;
type ByteEnd;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type ByteStart = Unset;
type ByteEnd = Unset;
}
pub struct SetByteStart<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetByteStart<St> {}
impl<St: State> State for SetByteStart<St> {
type ByteStart = Set<members::byte_start>;
type ByteEnd = St::ByteEnd;
}
pub struct SetByteEnd<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetByteEnd<St> {}
impl<St: State> State for SetByteEnd<St> {
type ByteStart = St::ByteStart;
type ByteEnd = Set<members::byte_end>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct byte_start(());
pub struct byte_end(());
}
}
pub struct ByteSliceBuilder<S: BosStr, St: byte_slice_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> ByteSlice<S> {
pub fn new() -> ByteSliceBuilder<S, byte_slice_state::Empty> {
ByteSliceBuilder::new()
}
}
impl<S: BosStr> ByteSliceBuilder<S, byte_slice_state::Empty> {
pub fn new() -> Self {
ByteSliceBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ByteSliceBuilder<S, St>
where
St: byte_slice_state::State,
St::ByteEnd: byte_slice_state::IsUnset,
{
pub fn byte_end(
mut self,
value: impl Into<i64>,
) -> ByteSliceBuilder<S, byte_slice_state::SetByteEnd<St>> {
self._fields.0 = Option::Some(value.into());
ByteSliceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ByteSliceBuilder<S, St>
where
St: byte_slice_state::State,
St::ByteStart: byte_slice_state::IsUnset,
{
pub fn byte_start(
mut self,
value: impl Into<i64>,
) -> ByteSliceBuilder<S, byte_slice_state::SetByteStart<St>> {
self._fields.1 = Option::Some(value.into());
ByteSliceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ByteSliceBuilder<S, St>
where
St: byte_slice_state::State,
St::ByteStart: byte_slice_state::IsSet,
St::ByteEnd: byte_slice_state::IsSet,
{
pub fn build(self) -> ByteSlice<S> {
ByteSlice {
byte_end: self._fields.0.unwrap(),
byte_start: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ByteSlice<S> {
ByteSlice {
byte_end: self._fields.0.unwrap(),
byte_start: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod heading_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Level;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Level = Unset;
}
pub struct SetLevel<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetLevel<St> {}
impl<St: State> State for SetLevel<St> {
type Level = Set<members::level>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct level(());
}
}
pub struct HeadingBuilder<S: BosStr, St: heading_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Heading<S> {
pub fn new() -> HeadingBuilder<S, heading_state::Empty> {
HeadingBuilder::new()
}
}
impl<S: BosStr> HeadingBuilder<S, heading_state::Empty> {
pub fn new() -> Self {
HeadingBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> HeadingBuilder<S, St>
where
St: heading_state::State,
St::Level: heading_state::IsUnset,
{
pub fn level(
mut self,
value: impl Into<i64>,
) -> HeadingBuilder<S, heading_state::SetLevel<St>> {
self._fields.0 = Option::Some(value.into());
HeadingBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> HeadingBuilder<S, St>
where
St: heading_state::State,
St::Level: heading_state::IsSet,
{
pub fn build(self) -> Heading<S> {
Heading {
level: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Heading<S> {
Heading {
level: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod image_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Blob;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Blob = Unset;
}
pub struct SetBlob<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBlob<St> {}
impl<St: State> State for SetBlob<St> {
type Blob = Set<members::blob>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct blob(());
}
}
pub struct ImageBuilder<S: BosStr, St: image_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<BlobRef<S>>, Option<i64>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Image<S> {
pub fn new() -> ImageBuilder<S, image_state::Empty> {
ImageBuilder::new()
}
}
impl<S: BosStr> ImageBuilder<S, image_state::Empty> {
pub fn new() -> Self {
ImageBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: image_state::State> ImageBuilder<S, St> {
pub fn alt(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_alt(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> ImageBuilder<S, St>
where
St: image_state::State,
St::Blob: image_state::IsUnset,
{
pub fn blob(
mut self,
value: impl Into<BlobRef<S>>,
) -> ImageBuilder<S, image_state::SetBlob<St>> {
self._fields.1 = Option::Some(value.into());
ImageBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: image_state::State> ImageBuilder<S, St> {
pub fn height(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_height(mut self, value: Option<i64>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: image_state::State> ImageBuilder<S, St> {
pub fn width(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_width(mut self, value: Option<i64>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> ImageBuilder<S, St>
where
St: image_state::State,
St::Blob: image_state::IsSet,
{
pub fn build(self) -> Image<S> {
Image {
alt: self._fields.0,
blob: self._fields.1.unwrap(),
height: self._fields.2,
width: self._fields.3,
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Image<S> {
Image {
alt: self._fields.0,
blob: self._fields.1.unwrap(),
height: self._fields.2,
width: self._fields.3,
extra_data: Some(extra_data),
}
}
}
pub mod link_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
}
}
pub struct LinkBuilder<S: BosStr, St: link_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<UriValue<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Link<S> {
pub fn new() -> LinkBuilder<S, link_state::Empty> {
LinkBuilder::new()
}
}
impl<S: BosStr> LinkBuilder<S, link_state::Empty> {
pub fn new() -> Self {
LinkBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LinkBuilder<S, St>
where
St: link_state::State,
St::Uri: link_state::IsUnset,
{
pub fn uri(mut self, value: impl Into<UriValue<S>>) -> LinkBuilder<S, link_state::SetUri<St>> {
self._fields.0 = Option::Some(value.into());
LinkBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LinkBuilder<S, St>
where
St: link_state::State,
St::Uri: link_state::IsSet,
{
pub fn build(self) -> Link<S> {
Link {
uri: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Link<S> {
Link {
uri: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn _default_list_item_depth() -> Option<i64> {
Some(0i64)
}
impl Default for ListItem {
fn default() -> Self {
Self {
depth: Some(0i64),
ordered: None,
extra_data: Default::default(),
}
}
}
pub mod facet_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Index;
type Features;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Index = Unset;
type Features = Unset;
}
pub struct SetIndex<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetIndex<St> {}
impl<St: State> State for SetIndex<St> {
type Index = Set<members::index>;
type Features = St::Features;
}
pub struct SetFeatures<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetFeatures<St> {}
impl<St: State> State for SetFeatures<St> {
type Index = St::Index;
type Features = Set<members::features>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct index(());
pub struct features(());
}
}
pub struct FacetBuilder<S: BosStr, St: facet_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Vec<FacetFeaturesItem<S>>>,
Option<facet::ByteSlice<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Facet<S> {
pub fn new() -> FacetBuilder<S, facet_state::Empty> {
FacetBuilder::new()
}
}
impl<S: BosStr> FacetBuilder<S, facet_state::Empty> {
pub fn new() -> Self {
FacetBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FacetBuilder<S, St>
where
St: facet_state::State,
St::Features: facet_state::IsUnset,
{
pub fn features(
mut self,
value: impl Into<Vec<FacetFeaturesItem<S>>>,
) -> FacetBuilder<S, facet_state::SetFeatures<St>> {
self._fields.0 = Option::Some(value.into());
FacetBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FacetBuilder<S, St>
where
St: facet_state::State,
St::Index: facet_state::IsUnset,
{
pub fn index(
mut self,
value: impl Into<facet::ByteSlice<S>>,
) -> FacetBuilder<S, facet_state::SetIndex<St>> {
self._fields.1 = Option::Some(value.into());
FacetBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FacetBuilder<S, St>
where
St: facet_state::State,
St::Index: facet_state::IsSet,
St::Features: facet_state::IsSet,
{
pub fn build(self) -> Facet<S> {
Facet {
features: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Facet<S> {
Facet {
features: self._fields.0.unwrap(),
index: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod mention_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Did;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Did = Unset;
}
pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetDid<St> {}
impl<St: State> State for SetDid<St> {
type Did = Set<members::did>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct did(());
}
}
pub struct MentionBuilder<S: BosStr, St: mention_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Did<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Mention<S> {
pub fn new() -> MentionBuilder<S, mention_state::Empty> {
MentionBuilder::new()
}
}
impl<S: BosStr> MentionBuilder<S, mention_state::Empty> {
pub fn new() -> Self {
MentionBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> MentionBuilder<S, St>
where
St: mention_state::State,
St::Did: mention_state::IsUnset,
{
pub fn did(mut self, value: impl Into<Did<S>>) -> MentionBuilder<S, mention_state::SetDid<St>> {
self._fields.0 = Option::Some(value.into());
MentionBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> MentionBuilder<S, St>
where
St: mention_state::State,
St::Did: mention_state::IsSet,
{
pub fn build(self) -> Mention<S> {
Mention {
did: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Mention<S> {
Mention {
did: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}