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;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{AtUri, Nsid};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, lexicon, 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;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct CachePolicy<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub life: Option<CachePolicyLife<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub tags: Option<Vec<CachePolicyTagsItem<'a>>>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum CachePolicyLife<'a> {
Seconds,
Minutes,
Hours,
Max,
Other(CowStr<'a>),
}
impl<'a> CachePolicyLife<'a> {
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(),
}
}
}
impl<'a> From<&'a str> for CachePolicyLife<'a> {
fn from(s: &'a str) -> Self {
match s {
"seconds" => Self::Seconds,
"minutes" => Self::Minutes,
"hours" => Self::Hours,
"max" => Self::Max,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> From<String> for CachePolicyLife<'a> {
fn from(s: String) -> Self {
match s.as_str() {
"seconds" => Self::Seconds,
"minutes" => Self::Minutes,
"hours" => Self::Hours,
"max" => Self::Max,
_ => Self::Other(CowStr::from(s)),
}
}
}
impl<'a> core::fmt::Display for CachePolicyLife<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<'a> AsRef<str> for CachePolicyLife<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<'a> serde::Serialize for CachePolicyLife<'a> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
impl<'de, 'a> serde::Deserialize<'de> for CachePolicyLife<'a>
where
'de: 'a,
{
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = <&'de str>::deserialize(deserializer)?;
Ok(Self::from(s))
}
}
impl<'a> Default for CachePolicyLife<'a> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl jacquard_common::IntoStatic for CachePolicyLife<'_> {
type Output = CachePolicyLife<'static>;
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")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum CachePolicyTagsItem<'a> {
#[serde(rename = "at.inlay.defs#tagRecord")]
TagRecord(Box<at_inlay::TagRecord<'a>>),
#[serde(rename = "at.inlay.defs#tagLink")]
TagLink(Box<at_inlay::TagLink<'a>>),
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Element<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub key: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub props: Option<Data<'a>>,
#[serde(borrow)]
pub r#type: Nsid<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Response<'a> {
#[serde(borrow)]
pub cache: at_inlay::CachePolicy<'a>,
#[serde(borrow)]
pub node: at_inlay::Element<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct TagLink<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub from: Option<Nsid<'a>>,
#[serde(borrow)]
pub subject: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct TagRecord<'a> {
#[serde(borrow)]
pub uri: AtUri<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ViaValtown<'a> {
#[serde(borrow)]
pub val_id: CowStr<'a>,
}
impl<'a> LexiconSchema for CachePolicy<'a> {
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<'a> LexiconSchema for Element<'a> {
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<'a> LexiconSchema for Response<'a> {
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<'a> LexiconSchema for TagLink<'a> {
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<'a> LexiconSchema for TagRecord<'a> {
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<'a> LexiconSchema for ViaValtown<'a> {
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<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetType<S> {}
impl<S: State> State for SetType<S> {
type Type = Set<members::r#type>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct r#type(());
}
}
pub struct ElementBuilder<'a, S: element_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<Data<'a>>, Option<Nsid<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Element<'a> {
pub fn new() -> ElementBuilder<'a, element_state::Empty> {
ElementBuilder::new()
}
}
impl<'a> ElementBuilder<'a, element_state::Empty> {
pub fn new() -> Self {
ElementBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: element_state::State> ElementBuilder<'a, S> {
pub fn key(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_key(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S: element_state::State> ElementBuilder<'a, S> {
pub fn props(mut self, value: impl Into<Option<Data<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_props(mut self, value: Option<Data<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> ElementBuilder<'a, S>
where
S: element_state::State,
S::Type: element_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<Nsid<'a>>,
) -> ElementBuilder<'a, element_state::SetType<S>> {
self._fields.2 = Option::Some(value.into());
ElementBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ElementBuilder<'a, S>
where
S: element_state::State,
S::Type: element_state::IsSet,
{
pub fn build(self) -> Element<'a> {
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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> Element<'a> {
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<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCache<S> {}
impl<S: State> State for SetCache<S> {
type Cache = Set<members::cache>;
type Node = S::Node;
}
pub struct SetNode<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetNode<S> {}
impl<S: State> State for SetNode<S> {
type Cache = S::Cache;
type Node = Set<members::node>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct cache(());
pub struct node(());
}
}
pub struct ResponseBuilder<'a, S: response_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<at_inlay::CachePolicy<'a>>, Option<at_inlay::Element<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Response<'a> {
pub fn new() -> ResponseBuilder<'a, response_state::Empty> {
ResponseBuilder::new()
}
}
impl<'a> ResponseBuilder<'a, response_state::Empty> {
pub fn new() -> Self {
ResponseBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ResponseBuilder<'a, S>
where
S: response_state::State,
S::Cache: response_state::IsUnset,
{
pub fn cache(
mut self,
value: impl Into<at_inlay::CachePolicy<'a>>,
) -> ResponseBuilder<'a, response_state::SetCache<S>> {
self._fields.0 = Option::Some(value.into());
ResponseBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ResponseBuilder<'a, S>
where
S: response_state::State,
S::Node: response_state::IsUnset,
{
pub fn node(
mut self,
value: impl Into<at_inlay::Element<'a>>,
) -> ResponseBuilder<'a, response_state::SetNode<S>> {
self._fields.1 = Option::Some(value.into());
ResponseBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ResponseBuilder<'a, S>
where
S: response_state::State,
S::Cache: response_state::IsSet,
S::Node: response_state::IsSet,
{
pub fn build(self) -> Response<'a> {
Response {
cache: self._fields.0.unwrap(),
node: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> Response<'a> {
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<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSubject<S> {}
impl<S: State> State for SetSubject<S> {
type Subject = Set<members::subject>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct subject(());
}
}
pub struct TagLinkBuilder<'a, S: tag_link_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Nsid<'a>>, Option<AtUri<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> TagLink<'a> {
pub fn new() -> TagLinkBuilder<'a, tag_link_state::Empty> {
TagLinkBuilder::new()
}
}
impl<'a> TagLinkBuilder<'a, tag_link_state::Empty> {
pub fn new() -> Self {
TagLinkBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: tag_link_state::State> TagLinkBuilder<'a, S> {
pub fn from(mut self, value: impl Into<Option<Nsid<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_from(mut self, value: Option<Nsid<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S> TagLinkBuilder<'a, S>
where
S: tag_link_state::State,
S::Subject: tag_link_state::IsUnset,
{
pub fn subject(
mut self,
value: impl Into<AtUri<'a>>,
) -> TagLinkBuilder<'a, tag_link_state::SetSubject<S>> {
self._fields.1 = Option::Some(value.into());
TagLinkBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> TagLinkBuilder<'a, S>
where
S: tag_link_state::State,
S::Subject: tag_link_state::IsSet,
{
pub fn build(self) -> TagLink<'a> {
TagLink {
from: self._fields.0,
subject: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> TagLink<'a> {
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<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
}
}
pub struct TagRecordBuilder<'a, S: tag_record_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<AtUri<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> TagRecord<'a> {
pub fn new() -> TagRecordBuilder<'a, tag_record_state::Empty> {
TagRecordBuilder::new()
}
}
impl<'a> TagRecordBuilder<'a, tag_record_state::Empty> {
pub fn new() -> Self {
TagRecordBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> TagRecordBuilder<'a, S>
where
S: tag_record_state::State,
S::Uri: tag_record_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<'a>>,
) -> TagRecordBuilder<'a, tag_record_state::SetUri<S>> {
self._fields.0 = Option::Some(value.into());
TagRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> TagRecordBuilder<'a, S>
where
S: tag_record_state::State,
S::Uri: tag_record_state::IsSet,
{
pub fn build(self) -> TagRecord<'a> {
TagRecord {
uri: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
) -> TagRecord<'a> {
TagRecord {
uri: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}