pub mod claim;
pub mod collection;
pub mod context;
pub mod funding;
pub mod helper;
pub mod workscope;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{BosStr, 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::UriValue;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct LargeBlob<S: BosStr = DefaultStr> {
pub blob: BlobRef<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 LargeImage<S: BosStr = DefaultStr> {
pub image: BlobRef<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 SmallBlob<S: BosStr = DefaultStr> {
pub blob: BlobRef<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 SmallImage<S: BosStr = DefaultStr> {
pub image: BlobRef<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 SmallVideo<S: BosStr = DefaultStr> {
pub video: BlobRef<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 Uri<S: BosStr = DefaultStr> {
pub uri: UriValue<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for LargeBlob<S> {
fn nsid() -> &'static str {
"org.hypercerts.defs"
}
fn def_name() -> &'static str {
"largeBlob"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_org_hypercerts_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.blob;
{
let size = value.blob().size;
if size > 104857600usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("blob"),
max: 104857600usize,
actual: size,
});
}
}
}
{
let value = &self.blob;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["*/*"];
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!["*/*".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for LargeImage<S> {
fn nsid() -> &'static str {
"org.hypercerts.defs"
}
fn def_name() -> &'static str {
"largeImage"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_org_hypercerts_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.image;
{
let size = value.blob().size;
if size > 10485760usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("image"),
max: 10485760usize,
actual: size,
});
}
}
}
{
let value = &self.image;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["image/jpeg", "image/jpg", "image/png", "image/webp"];
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("image"),
accepted: vec![
"image/jpeg".to_string(),
"image/jpg".to_string(),
"image/png".to_string(),
"image/webp".to_string(),
],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for SmallBlob<S> {
fn nsid() -> &'static str {
"org.hypercerts.defs"
}
fn def_name() -> &'static str {
"smallBlob"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_org_hypercerts_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.blob;
{
let size = value.blob().size;
if size > 10485760usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("blob"),
max: 10485760usize,
actual: size,
});
}
}
}
{
let value = &self.blob;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["*/*"];
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!["*/*".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for SmallImage<S> {
fn nsid() -> &'static str {
"org.hypercerts.defs"
}
fn def_name() -> &'static str {
"smallImage"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_org_hypercerts_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.image;
{
let size = value.blob().size;
if size > 5242880usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("image"),
max: 5242880usize,
actual: size,
});
}
}
}
{
let value = &self.image;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["image/jpeg", "image/jpg", "image/png", "image/webp"];
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("image"),
accepted: vec![
"image/jpeg".to_string(),
"image/jpg".to_string(),
"image/png".to_string(),
"image/webp".to_string(),
],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for SmallVideo<S> {
fn nsid() -> &'static str {
"org.hypercerts.defs"
}
fn def_name() -> &'static str {
"smallVideo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_org_hypercerts_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.video;
{
let size = value.blob().size;
if size > 20971520usize {
return Err(ConstraintError::BlobTooLarge {
path: ValidationPath::from_field("video"),
max: 20971520usize,
actual: size,
});
}
}
}
{
let value = &self.video;
{
let mime = value.blob().mime_type.as_str();
let accepted: &[&str] = &["video/mp4", "video/webm"];
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("video"),
accepted: vec!["video/mp4".to_string(), "video/webm".to_string()],
actual: mime.to_string(),
});
}
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Uri<S> {
fn nsid() -> &'static str {
"org.hypercerts.defs"
}
fn def_name() -> &'static str {
"uri"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_org_hypercerts_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod large_blob_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 LargeBlobBuilder<S: BosStr, St: large_blob_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<BlobRef<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> LargeBlob<S> {
pub fn new() -> LargeBlobBuilder<S, large_blob_state::Empty> {
LargeBlobBuilder::new()
}
}
impl<S: BosStr> LargeBlobBuilder<S, large_blob_state::Empty> {
pub fn new() -> Self {
LargeBlobBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LargeBlobBuilder<S, St>
where
St: large_blob_state::State,
St::Blob: large_blob_state::IsUnset,
{
pub fn blob(
mut self,
value: impl Into<BlobRef<S>>,
) -> LargeBlobBuilder<S, large_blob_state::SetBlob<St>> {
self._fields.0 = Option::Some(value.into());
LargeBlobBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LargeBlobBuilder<S, St>
where
St: large_blob_state::State,
St::Blob: large_blob_state::IsSet,
{
pub fn build(self) -> LargeBlob<S> {
LargeBlob {
blob: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> LargeBlob<S> {
LargeBlob {
blob: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_org_hypercerts_defs() -> 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("org.hypercerts.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("largeBlob"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Object containing a blob to external data",
)),
required: Some(vec![SmolStr::new_static("blob")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("blob"),
LexObjectProperty::Blob(LexBlob {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("largeImage"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Object containing a large image")),
required: Some(vec![SmolStr::new_static("image")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("image"),
LexObjectProperty::Blob(LexBlob {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("smallBlob"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Object containing a blob to external data",
)),
required: Some(vec![SmolStr::new_static("blob")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("blob"),
LexObjectProperty::Blob(LexBlob {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("smallImage"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Object containing a small image")),
required: Some(vec![SmolStr::new_static("image")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("image"),
LexObjectProperty::Blob(LexBlob {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("smallVideo"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Object containing a small video")),
required: Some(vec![SmolStr::new_static("video")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("video"),
LexObjectProperty::Blob(LexBlob {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("uri"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static(
"Object containing a URI to external data",
)),
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 {
description: Some(CowStr::new_static("URI to external data")),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod large_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 Image;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Image = Unset;
}
pub struct SetImage<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetImage<St> {}
impl<St: State> State for SetImage<St> {
type Image = Set<members::image>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct image(());
}
}
pub struct LargeImageBuilder<S: BosStr, St: large_image_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<BlobRef<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> LargeImage<S> {
pub fn new() -> LargeImageBuilder<S, large_image_state::Empty> {
LargeImageBuilder::new()
}
}
impl<S: BosStr> LargeImageBuilder<S, large_image_state::Empty> {
pub fn new() -> Self {
LargeImageBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LargeImageBuilder<S, St>
where
St: large_image_state::State,
St::Image: large_image_state::IsUnset,
{
pub fn image(
mut self,
value: impl Into<BlobRef<S>>,
) -> LargeImageBuilder<S, large_image_state::SetImage<St>> {
self._fields.0 = Option::Some(value.into());
LargeImageBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LargeImageBuilder<S, St>
where
St: large_image_state::State,
St::Image: large_image_state::IsSet,
{
pub fn build(self) -> LargeImage<S> {
LargeImage {
image: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> LargeImage<S> {
LargeImage {
image: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod small_blob_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 SmallBlobBuilder<S: BosStr, St: small_blob_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<BlobRef<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SmallBlob<S> {
pub fn new() -> SmallBlobBuilder<S, small_blob_state::Empty> {
SmallBlobBuilder::new()
}
}
impl<S: BosStr> SmallBlobBuilder<S, small_blob_state::Empty> {
pub fn new() -> Self {
SmallBlobBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SmallBlobBuilder<S, St>
where
St: small_blob_state::State,
St::Blob: small_blob_state::IsUnset,
{
pub fn blob(
mut self,
value: impl Into<BlobRef<S>>,
) -> SmallBlobBuilder<S, small_blob_state::SetBlob<St>> {
self._fields.0 = Option::Some(value.into());
SmallBlobBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SmallBlobBuilder<S, St>
where
St: small_blob_state::State,
St::Blob: small_blob_state::IsSet,
{
pub fn build(self) -> SmallBlob<S> {
SmallBlob {
blob: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> SmallBlob<S> {
SmallBlob {
blob: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod small_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 Image;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Image = Unset;
}
pub struct SetImage<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetImage<St> {}
impl<St: State> State for SetImage<St> {
type Image = Set<members::image>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct image(());
}
}
pub struct SmallImageBuilder<S: BosStr, St: small_image_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<BlobRef<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SmallImage<S> {
pub fn new() -> SmallImageBuilder<S, small_image_state::Empty> {
SmallImageBuilder::new()
}
}
impl<S: BosStr> SmallImageBuilder<S, small_image_state::Empty> {
pub fn new() -> Self {
SmallImageBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SmallImageBuilder<S, St>
where
St: small_image_state::State,
St::Image: small_image_state::IsUnset,
{
pub fn image(
mut self,
value: impl Into<BlobRef<S>>,
) -> SmallImageBuilder<S, small_image_state::SetImage<St>> {
self._fields.0 = Option::Some(value.into());
SmallImageBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SmallImageBuilder<S, St>
where
St: small_image_state::State,
St::Image: small_image_state::IsSet,
{
pub fn build(self) -> SmallImage<S> {
SmallImage {
image: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> SmallImage<S> {
SmallImage {
image: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod small_video_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 Video;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Video = Unset;
}
pub struct SetVideo<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetVideo<St> {}
impl<St: State> State for SetVideo<St> {
type Video = Set<members::video>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct video(());
}
}
pub struct SmallVideoBuilder<S: BosStr, St: small_video_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<BlobRef<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> SmallVideo<S> {
pub fn new() -> SmallVideoBuilder<S, small_video_state::Empty> {
SmallVideoBuilder::new()
}
}
impl<S: BosStr> SmallVideoBuilder<S, small_video_state::Empty> {
pub fn new() -> Self {
SmallVideoBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SmallVideoBuilder<S, St>
where
St: small_video_state::State,
St::Video: small_video_state::IsUnset,
{
pub fn video(
mut self,
value: impl Into<BlobRef<S>>,
) -> SmallVideoBuilder<S, small_video_state::SetVideo<St>> {
self._fields.0 = Option::Some(value.into());
SmallVideoBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SmallVideoBuilder<S, St>
where
St: small_video_state::State,
St::Video: small_video_state::IsSet,
{
pub fn build(self) -> SmallVideo<S> {
SmallVideo {
video: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> SmallVideo<S> {
SmallVideo {
video: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod uri_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 UriBuilder<S: BosStr, St: uri_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<UriValue<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Uri<S> {
pub fn new() -> UriBuilder<S, uri_state::Empty> {
UriBuilder::new()
}
}
impl<S: BosStr> UriBuilder<S, uri_state::Empty> {
pub fn new() -> Self {
UriBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> UriBuilder<S, St>
where
St: uri_state::State,
St::Uri: uri_state::IsUnset,
{
pub fn uri(mut self, value: impl Into<UriValue<S>>) -> UriBuilder<S, uri_state::SetUri<St>> {
self._fields.0 = Option::Some(value.into());
UriBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> UriBuilder<S, St>
where
St: uri_state::State,
St::Uri: uri_state::IsSet,
{
pub fn build(self) -> Uri<S> {
Uri {
uri: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Uri<S> {
Uri {
uri: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}