pub mod binding;
pub mod component;
pub mod fragment;
pub mod loading;
pub mod maybe;
pub mod missing;
pub mod pack;
pub mod placeholder;
pub mod slot;
pub mod throw;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, 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::string::{AtUri, Nsid};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::at_inlay;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CachePolicy<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub life: Option<CachePolicyLife<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<CachePolicyTagsItem<S>>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum CachePolicyLife<S: BosStr = DefaultStr> {
Seconds,
Minutes,
Hours,
Max,
Other(S),
}
impl<S: BosStr> CachePolicyLife<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Seconds => "seconds",
Self::Minutes => "minutes",
Self::Hours => "hours",
Self::Max => "max",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"seconds" => Self::Seconds,
"minutes" => Self::Minutes,
"hours" => Self::Hours,
"max" => Self::Max,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for CachePolicyLife<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for CachePolicyLife<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for CachePolicyLife<S> {
fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error>
where
Ser: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for CachePolicyLife<S> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = S::deserialize(deserializer)?;
Ok(Self::from_value(s))
}
}
impl<S: BosStr + Default> Default for CachePolicyLife<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for CachePolicyLife<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = CachePolicyLife<S::Output>;
fn into_static(self) -> Self::Output {
match self {
CachePolicyLife::Seconds => CachePolicyLife::Seconds,
CachePolicyLife::Minutes => CachePolicyLife::Minutes,
CachePolicyLife::Hours => CachePolicyLife::Hours,
CachePolicyLife::Max => CachePolicyLife::Max,
CachePolicyLife::Other(v) => CachePolicyLife::Other(v.into_static()),
}
}
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum CachePolicyTagsItem<S: BosStr = DefaultStr> {
#[serde(rename = "at.inlay.defs#tagRecord")]
TagRecord(Box<at_inlay::TagRecord<S>>),
#[serde(rename = "at.inlay.defs#tagLink")]
TagLink(Box<at_inlay::TagLink<S>>),
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Element<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub props: Option<Data<S>>,
pub r#type: Nsid<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 Response<S: BosStr = DefaultStr> {
pub cache: at_inlay::CachePolicy<S>,
pub node: at_inlay::Element<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 TagLink<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub from: Option<Nsid<S>>,
pub subject: AtUri<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 TagRecord<S: BosStr = DefaultStr> {
pub uri: AtUri<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 ViaValtown<S: BosStr = DefaultStr> {
pub val_id: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for CachePolicy<S> {
fn nsid() -> &'static str {
"at.inlay.defs"
}
fn def_name() -> &'static str {
"cachePolicy"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_at_inlay_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.life {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 32usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("life"),
max: 32usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Element<S> {
fn nsid() -> &'static str {
"at.inlay.defs"
}
fn def_name() -> &'static str {
"element"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_at_inlay_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.key {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("key"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Response<S> {
fn nsid() -> &'static str {
"at.inlay.defs"
}
fn def_name() -> &'static str {
"response"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_at_inlay_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for TagLink<S> {
fn nsid() -> &'static str {
"at.inlay.defs"
}
fn def_name() -> &'static str {
"tagLink"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_at_inlay_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for TagRecord<S> {
fn nsid() -> &'static str {
"at.inlay.defs"
}
fn def_name() -> &'static str {
"tagRecord"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_at_inlay_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for ViaValtown<S> {
fn nsid() -> &'static str {
"at.inlay.defs"
}
fn def_name() -> &'static str {
"viaValtown"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_at_inlay_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.val_id;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("val_id"),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
fn lexicon_doc_at_inlay_defs() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("at.inlay.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cachePolicy"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Cache lifetime and invalidation tags returned by XRPC components.",
),
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("life"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"How frequently the underlying data changes",
),
),
max_length: Some(32usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tags"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Data dependencies for cache invalidation",
),
),
items: LexArrayItem::Union(LexRefUnion {
refs: vec![
CowStr::new_static("#tagRecord"),
CowStr::new_static("#tagLink")
],
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("element"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("A renderable Inlay element.")),
required: Some(vec![SmolStr::new_static("type")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("key"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Stable key that identifies the component among its siblings.",
),
),
max_length: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("props"),
LexObjectProperty::Unknown(LexUnknown {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("type"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("NSID of the component to render."),
),
format: Some(LexStringFormat::Nsid),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("response"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Standard response from a component render call.",
),
),
required: Some(
vec![SmolStr::new_static("node"), SmolStr::new_static("cache")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cache"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#cachePolicy"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("node"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#element"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tagLink"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Cache tag: depend on backlink relationships to a subject.",
),
),
required: Some(vec![SmolStr::new_static("subject")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("from"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Collection NSID of the linking records. Omit for any collection.",
),
),
format: Some(LexStringFormat::Nsid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("subject"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Subject AT URI that is linked to"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("tagRecord"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Cache tag: depend on a specific record, collection, or identity.",
),
),
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(
"AT URI at record, collection, or identity granularity",
),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("viaValtown"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("valId")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("valId"),
LexObjectProperty::String(LexString {
description: Some(CowStr::new_static("Val Town val UUID")),
max_length: Some(128usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod element_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 Type;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Type = Unset;
}
pub struct SetType<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetType<St> {}
impl<St: State> State for SetType<St> {
type Type = Set<members::r#type>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct r#type(());
}
}
pub struct ElementBuilder<S: BosStr, St: element_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<Data<S>>, Option<Nsid<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Element<S> {
pub fn new() -> ElementBuilder<S, element_state::Empty> {
ElementBuilder::new()
}
}
impl<S: BosStr> ElementBuilder<S, element_state::Empty> {
pub fn new() -> Self {
ElementBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: element_state::State> ElementBuilder<S, St> {
pub fn key(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_key(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St: element_state::State> ElementBuilder<S, St> {
pub fn props(mut self, value: impl Into<Option<Data<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_props(mut self, value: Option<Data<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> ElementBuilder<S, St>
where
St: element_state::State,
St::Type: element_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<Nsid<S>>,
) -> ElementBuilder<S, element_state::SetType<St>> {
self._fields.2 = Option::Some(value.into());
ElementBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ElementBuilder<S, St>
where
St: element_state::State,
St::Type: element_state::IsSet,
{
pub fn build(self) -> Element<S> {
Element {
key: self._fields.0,
props: self._fields.1,
r#type: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Element<S> {
Element {
key: self._fields.0,
props: self._fields.1,
r#type: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod response_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 Cache;
type Node;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Cache = Unset;
type Node = Unset;
}
pub struct SetCache<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCache<St> {}
impl<St: State> State for SetCache<St> {
type Cache = Set<members::cache>;
type Node = St::Node;
}
pub struct SetNode<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetNode<St> {}
impl<St: State> State for SetNode<St> {
type Cache = St::Cache;
type Node = Set<members::node>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct cache(());
pub struct node(());
}
}
pub struct ResponseBuilder<S: BosStr, St: response_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<at_inlay::CachePolicy<S>>, Option<at_inlay::Element<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Response<S> {
pub fn new() -> ResponseBuilder<S, response_state::Empty> {
ResponseBuilder::new()
}
}
impl<S: BosStr> ResponseBuilder<S, response_state::Empty> {
pub fn new() -> Self {
ResponseBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ResponseBuilder<S, St>
where
St: response_state::State,
St::Cache: response_state::IsUnset,
{
pub fn cache(
mut self,
value: impl Into<at_inlay::CachePolicy<S>>,
) -> ResponseBuilder<S, response_state::SetCache<St>> {
self._fields.0 = Option::Some(value.into());
ResponseBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ResponseBuilder<S, St>
where
St: response_state::State,
St::Node: response_state::IsUnset,
{
pub fn node(
mut self,
value: impl Into<at_inlay::Element<S>>,
) -> ResponseBuilder<S, response_state::SetNode<St>> {
self._fields.1 = Option::Some(value.into());
ResponseBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ResponseBuilder<S, St>
where
St: response_state::State,
St::Cache: response_state::IsSet,
St::Node: response_state::IsSet,
{
pub fn build(self) -> Response<S> {
Response {
cache: self._fields.0.unwrap(),
node: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Response<S> {
Response {
cache: self._fields.0.unwrap(),
node: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod tag_link_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 Subject;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Subject = Unset;
}
pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSubject<St> {}
impl<St: State> State for SetSubject<St> {
type Subject = Set<members::subject>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct subject(());
}
}
pub struct TagLinkBuilder<S: BosStr, St: tag_link_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Nsid<S>>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> TagLink<S> {
pub fn new() -> TagLinkBuilder<S, tag_link_state::Empty> {
TagLinkBuilder::new()
}
}
impl<S: BosStr> TagLinkBuilder<S, tag_link_state::Empty> {
pub fn new() -> Self {
TagLinkBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: tag_link_state::State> TagLinkBuilder<S, St> {
pub fn from(mut self, value: impl Into<Option<Nsid<S>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_from(mut self, value: Option<Nsid<S>>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> TagLinkBuilder<S, St>
where
St: tag_link_state::State,
St::Subject: tag_link_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<AtUri<S>>,
) -> TagLinkBuilder<S, tag_link_state::SetSubject<St>> {
self._fields.1 = Option::Some(value.into());
TagLinkBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TagLinkBuilder<S, St>
where
St: tag_link_state::State,
St::Subject: tag_link_state::IsSet,
{
pub fn build(self) -> TagLink<S> {
TagLink {
from: self._fields.0,
subject: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> TagLink<S> {
TagLink {
from: self._fields.0,
subject: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod tag_record_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 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 TagRecordBuilder<S: BosStr, St: tag_record_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> TagRecord<S> {
pub fn new() -> TagRecordBuilder<S, tag_record_state::Empty> {
TagRecordBuilder::new()
}
}
impl<S: BosStr> TagRecordBuilder<S, tag_record_state::Empty> {
pub fn new() -> Self {
TagRecordBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TagRecordBuilder<S, St>
where
St: tag_record_state::State,
St::Uri: tag_record_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> TagRecordBuilder<S, tag_record_state::SetUri<St>> {
self._fields.0 = Option::Some(value.into());
TagRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TagRecordBuilder<S, St>
where
St: tag_record_state::State,
St::Uri: tag_record_state::IsSet,
{
pub fn build(self) -> TagRecord<S> {
TagRecord {
uri: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> TagRecord<S> {
TagRecord {
uri: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}