#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Item<'a> {
#[serde(borrow)]
pub item_identifier: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub item_weight: std::option::Option<jacquard_common::CowStr<'a>>,
}
pub mod item_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 ItemIdentifier;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type ItemIdentifier = Unset;
}
pub struct SetItemIdentifier<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetItemIdentifier<S> {}
impl<S: State> State for SetItemIdentifier<S> {
type ItemIdentifier = Set<members::item_identifier>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct item_identifier(());
}
}
pub struct ItemBuilder<'a, S: item_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Item<'a> {
pub fn new() -> ItemBuilder<'a, item_state::Empty> {
ItemBuilder::new()
}
}
impl<'a> ItemBuilder<'a, item_state::Empty> {
pub fn new() -> Self {
ItemBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ItemBuilder<'a, S>
where
S: item_state::State,
S::ItemIdentifier: item_state::IsUnset,
{
pub fn item_identifier(
mut self,
value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> ItemBuilder<'a, item_state::SetItemIdentifier<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ItemBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: item_state::State> ItemBuilder<'a, S> {
pub fn item_weight(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_item_weight(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> ItemBuilder<'a, S>
where
S: item_state::State,
S::ItemIdentifier: item_state::IsSet,
{
pub fn build(self) -> Item<'a> {
Item {
item_identifier: self.__unsafe_private_named.0.unwrap(),
item_weight: self.__unsafe_private_named.1,
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>,
>,
) -> Item<'a> {
Item {
item_identifier: self.__unsafe_private_named.0.unwrap(),
item_weight: self.__unsafe_private_named.1,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_org_hypercerts_collection() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("org.hypercerts.collection"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("item"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("itemIdentifier")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"itemIdentifier",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"itemWeight",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Optional weight for this item (positive numeric value stored as string). Weights do not need to sum to a specific total; normalization can be performed by the consuming application as needed.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(100usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: 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 collection/group of items (activities and/or other collections). Collections support recursive nesting.",
),
),
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("createdAt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"avatar",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"The collection's avatar/profile image as a URI or image blob.",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("org.hypercerts.defs#uri"),
::jacquard_common::CowStr::new_static("org.hypercerts.defs#smallImage")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"banner",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Larger horizontal image to display behind the collection view.",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("org.hypercerts.defs#uri"),
::jacquard_common::CowStr::new_static("org.hypercerts.defs#largeImage")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Client-declared timestamp when this record was originally created",
),
),
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(
"description",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"pub.leaflet.pages.linearDocument#main",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"items",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Array of items in this collection with optional weights.",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#item"),
}),
min_length: None,
max_length: Some(1000usize),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"location",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"shortDescription",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Short summary of this collection, suitable for previews and list views",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(3000usize),
min_graphemes: None,
max_graphemes: Some(300usize),
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: Some(
::jacquard_common::CowStr::new_static(
"Display name for this collection (e.g. 'Q1 2025 Impact Projects')",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(800usize),
min_graphemes: None,
max_graphemes: Some(80usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"type",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The type of this collection. Possible fields can be 'favorites', 'project', or any other type of collection.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(64usize),
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Item<'a> {
fn nsid() -> &'static str {
"org.hypercerts.collection"
}
fn def_name() -> &'static str {
"item"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_org_hypercerts_collection()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.item_weight {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"item_weight",
),
max: 100usize,
actual: <str>::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 Collection<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub avatar: std::option::Option<CollectionAvatar<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub banner: std::option::Option<CollectionBanner<'a>>,
pub created_at: jacquard_common::types::string::Datetime,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub description: std::option::Option<
crate::pub_leaflet::pages::linear_document::LinearDocument<'a>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub items: std::option::Option<Vec<crate::org_hypercerts::collection::Item<'a>>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub location: std::option::Option<
crate::com_atproto::repo::strong_ref::StrongRef<'a>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub short_description: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(borrow)]
pub title: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub r#type: std::option::Option<jacquard_common::CowStr<'a>>,
}
pub mod collection_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 CreatedAt;
type Title;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Title = Unset;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type CreatedAt = Set<members::created_at>;
type Title = S::Title;
}
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 CreatedAt = S::CreatedAt;
type Title = Set<members::title>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct title(());
}
}
pub struct CollectionBuilder<'a, S: collection_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<CollectionAvatar<'a>>,
::core::option::Option<CollectionBanner<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<
crate::pub_leaflet::pages::linear_document::LinearDocument<'a>,
>,
::core::option::Option<Vec<crate::org_hypercerts::collection::Item<'a>>>,
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Collection<'a> {
pub fn new() -> CollectionBuilder<'a, collection_state::Empty> {
CollectionBuilder::new()
}
}
impl<'a> CollectionBuilder<'a, collection_state::Empty> {
pub fn new() -> Self {
CollectionBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
pub fn avatar(mut self, value: impl Into<Option<CollectionAvatar<'a>>>) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_avatar(mut self, value: Option<CollectionAvatar<'a>>) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
pub fn banner(mut self, value: impl Into<Option<CollectionBanner<'a>>>) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_banner(mut self, value: Option<CollectionBanner<'a>>) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S> CollectionBuilder<'a, S>
where
S: collection_state::State,
S::CreatedAt: collection_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> CollectionBuilder<'a, collection_state::SetCreatedAt<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
CollectionBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
pub fn description(
mut self,
value: impl Into<
Option<crate::pub_leaflet::pages::linear_document::LinearDocument<'a>>,
>,
) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_description(
mut self,
value: Option<crate::pub_leaflet::pages::linear_document::LinearDocument<'a>>,
) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
pub fn items(
mut self,
value: impl Into<Option<Vec<crate::org_hypercerts::collection::Item<'a>>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_items(
mut self,
value: Option<Vec<crate::org_hypercerts::collection::Item<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
pub fn location(
mut self,
value: impl Into<Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>>,
) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_location(
mut self,
value: Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
pub fn short_description(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.6 = value.into();
self
}
pub fn maybe_short_description(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.6 = value;
self
}
}
impl<'a, S> CollectionBuilder<'a, S>
where
S: collection_state::State,
S::Title: collection_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> CollectionBuilder<'a, collection_state::SetTitle<S>> {
self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into());
CollectionBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: collection_state::State> CollectionBuilder<'a, S> {
pub fn r#type(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.8 = value.into();
self
}
pub fn maybe_type(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
self.__unsafe_private_named.8 = value;
self
}
}
impl<'a, S> CollectionBuilder<'a, S>
where
S: collection_state::State,
S::CreatedAt: collection_state::IsSet,
S::Title: collection_state::IsSet,
{
pub fn build(self) -> Collection<'a> {
Collection {
avatar: self.__unsafe_private_named.0,
banner: self.__unsafe_private_named.1,
created_at: self.__unsafe_private_named.2.unwrap(),
description: self.__unsafe_private_named.3,
items: self.__unsafe_private_named.4,
location: self.__unsafe_private_named.5,
short_description: self.__unsafe_private_named.6,
title: self.__unsafe_private_named.7.unwrap(),
r#type: self.__unsafe_private_named.8,
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>,
>,
) -> Collection<'a> {
Collection {
avatar: self.__unsafe_private_named.0,
banner: self.__unsafe_private_named.1,
created_at: self.__unsafe_private_named.2.unwrap(),
description: self.__unsafe_private_named.3,
items: self.__unsafe_private_named.4,
location: self.__unsafe_private_named.5,
short_description: self.__unsafe_private_named.6,
title: self.__unsafe_private_named.7.unwrap(),
r#type: self.__unsafe_private_named.8,
extra_data: Some(extra_data),
}
}
}
impl<'a> Collection<'a> {
pub fn uri(
uri: impl Into<jacquard_common::CowStr<'a>>,
) -> Result<
jacquard_common::types::uri::RecordUri<'a, CollectionRecord>,
jacquard_common::types::uri::UriError,
> {
jacquard_common::types::uri::RecordUri::try_from_uri(
jacquard_common::types::string::AtUri::new_cow(uri.into())?,
)
}
}
#[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 CollectionAvatar<'a> {
#[serde(rename = "org.hypercerts.defs#uri")]
Uri(Box<crate::org_hypercerts::Uri<'a>>),
#[serde(rename = "org.hypercerts.defs#smallImage")]
SmallImage(Box<crate::org_hypercerts::SmallImage<'a>>),
}
#[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 CollectionBanner<'a> {
#[serde(rename = "org.hypercerts.defs#uri")]
Uri(Box<crate::org_hypercerts::Uri<'a>>),
#[serde(rename = "org.hypercerts.defs#largeImage")]
LargeImage(Box<crate::org_hypercerts::LargeImage<'a>>),
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct CollectionGetRecordOutput<'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: Collection<'a>,
}
impl From<CollectionGetRecordOutput<'_>> for Collection<'_> {
fn from(output: CollectionGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl jacquard_common::types::collection::Collection for Collection<'_> {
const NSID: &'static str = "org.hypercerts.collection";
type Record = CollectionRecord;
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct CollectionRecord;
impl jacquard_common::xrpc::XrpcResp for CollectionRecord {
const NSID: &'static str = "org.hypercerts.collection";
const ENCODING: &'static str = "application/json";
type Output<'de> = CollectionGetRecordOutput<'de>;
type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}
impl jacquard_common::types::collection::Collection for CollectionRecord {
const NSID: &'static str = "org.hypercerts.collection";
type Record = CollectionRecord;
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Collection<'a> {
fn nsid() -> &'static str {
"org.hypercerts.collection"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_org_hypercerts_collection()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.items {
#[allow(unused_comparisons)]
if value.len() > 1000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"items",
),
max: 1000usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.short_description {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 3000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"short_description",
),
max: 3000usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.short_description {
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 300usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"short_description",
),
max: 300usize,
actual: count,
});
}
}
}
{
let value = &self.title;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 800usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"title",
),
max: 800usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.title;
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 80usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"title",
),
max: 80usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.r#type {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 64usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"type",
),
max: 64usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}