1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14
15#[allow(unused_imports)]
16use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
17use jacquard_common::types::string::{AtUri, Cid, Datetime};
18use jacquard_common::types::value::Data;
19use jacquard_derive::{IntoStatic, lexicon, open_union};
20use jacquard_lexicon::lexicon::LexiconDoc;
21use jacquard_lexicon::schema::LexiconSchema;
22
23#[allow(unused_imports)]
24use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
25use serde::{Serialize, Deserialize};
26use crate::app_bsky::feed::BlockedAuthor;
27use crate::app_bsky::feed::GeneratorView;
28use crate::app_bsky::graph::ListView;
29use crate::app_bsky::graph::StarterPackViewBasic;
30use crate::app_bsky::labeler::LabelerView;
31use crate::com_atproto::label::Label;
32use crate::com_atproto::repo::strong_ref::StrongRef;
33use crate::sh_weaver::actor::ProfileDataViewBasic;
34use crate::sh_weaver::embed::images;
35use crate::sh_weaver::embed::record_with_media;
36use crate::sh_weaver::embed::records;
37use crate::sh_weaver::embed::video;
38
39#[lexicon]
40#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
41#[serde(rename_all = "camelCase")]
42pub struct Records<'a> {
43 #[serde(borrow)]
44 pub records: Vec<records::RecordEmbed<'a>>,
45}
46
47
48#[lexicon]
49#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
50#[serde(rename_all = "camelCase")]
51pub struct RecordEmbed<'a> {
52 #[serde(skip_serializing_if = "Option::is_none")]
53 #[serde(borrow)]
54 pub name: Option<CowStr<'a>>,
55 #[serde(borrow)]
56 pub record: StrongRef<'a>,
57}
58
59
60#[lexicon]
61#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
62#[serde(rename_all = "camelCase")]
63pub struct RecordEmbedView<'a> {
64 #[serde(skip_serializing_if = "Option::is_none")]
65 #[serde(borrow)]
66 pub name: Option<CowStr<'a>>,
67 #[serde(borrow)]
68 pub record_view: RecordEmbedViewRecordView<'a>,
69}
70
71
72#[open_union]
73#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
74#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
75pub enum RecordEmbedViewRecordView<'a> {
76 #[serde(rename = "sh.weaver.embed.records#view")]
77 View(Box<records::View<'a>>),
78 #[serde(rename = "sh.weaver.embed.images#view")]
79 ImagesView(Box<images::View<'a>>),
80 #[serde(rename = "sh.weaver.embed.recordWithMedia#view")]
81 RecordWithMediaView(Box<record_with_media::View<'a>>),
82 #[serde(rename = "sh.weaver.embed.video#view")]
83 VideoView(Box<video::View<'a>>),
84}
85
86
87#[lexicon]
88#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
89#[serde(rename_all = "camelCase")]
90pub struct View<'a> {
91 #[serde(borrow)]
92 pub record: ViewUnionRecord<'a>,
93}
94
95
96#[open_union]
97#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
98#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
99pub enum ViewUnionRecord<'a> {
100 #[serde(rename = "sh.weaver.embed.records#viewRecord")]
101 ViewRecord(Box<records::ViewRecord<'a>>),
102 #[serde(rename = "sh.weaver.embed.records#viewNotFound")]
103 ViewNotFound(Box<records::ViewNotFound<'a>>),
104 #[serde(rename = "sh.weaver.embed.records#viewBlocked")]
105 ViewBlocked(Box<records::ViewBlocked<'a>>),
106 #[serde(rename = "sh.weaver.embed.records#viewDetached")]
107 ViewDetached(Box<records::ViewDetached<'a>>),
108 #[serde(rename = "app.bsky.feed.defs#generatorView")]
109 GeneratorView(Box<GeneratorView<'a>>),
110 #[serde(rename = "app.bsky.graph.defs#listView")]
111 ListView(Box<ListView<'a>>),
112 #[serde(rename = "app.bsky.labeler.defs#labelerView")]
113 LabelerView(Box<LabelerView<'a>>),
114 #[serde(rename = "app.bsky.graph.defs#starterPackViewBasic")]
115 StarterPackViewBasic(Box<StarterPackViewBasic<'a>>),
116}
117
118
119#[lexicon]
120#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
121#[serde(rename_all = "camelCase")]
122pub struct ViewBlocked<'a> {
123 #[serde(borrow)]
124 pub author: BlockedAuthor<'a>,
125 pub blocked: bool,
126 #[serde(borrow)]
127 pub uri: AtUri<'a>,
128}
129
130
131#[lexicon]
132#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
133#[serde(rename_all = "camelCase")]
134pub struct ViewDetached<'a> {
135 pub detached: bool,
136 #[serde(borrow)]
137 pub uri: AtUri<'a>,
138}
139
140
141#[lexicon]
142#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
143#[serde(rename_all = "camelCase")]
144pub struct ViewNotFound<'a> {
145 pub not_found: bool,
146 #[serde(borrow)]
147 pub uri: AtUri<'a>,
148}
149
150
151#[lexicon]
152#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
153#[serde(rename_all = "camelCase")]
154pub struct ViewRecord<'a> {
155 #[serde(borrow)]
156 pub author: ProfileDataViewBasic<'a>,
157 #[serde(borrow)]
158 pub cid: Cid<'a>,
159 #[serde(skip_serializing_if = "Option::is_none")]
160 #[serde(borrow)]
161 pub embeds: Option<Vec<records::RecordEmbedView<'a>>>,
162 pub indexed_at: Datetime,
163 #[serde(skip_serializing_if = "Option::is_none")]
164 #[serde(borrow)]
165 pub labels: Option<Vec<Label<'a>>>,
166 #[serde(skip_serializing_if = "Option::is_none")]
167 pub like_count: Option<i64>,
168 #[serde(skip_serializing_if = "Option::is_none")]
169 pub quote_count: Option<i64>,
170 #[serde(skip_serializing_if = "Option::is_none")]
171 pub reply_count: Option<i64>,
172 #[serde(skip_serializing_if = "Option::is_none")]
173 pub repost_count: Option<i64>,
174 #[serde(borrow)]
175 pub uri: AtUri<'a>,
176 #[serde(borrow)]
178 pub value: Data<'a>,
179}
180
181impl<'a> LexiconSchema for Records<'a> {
182 fn nsid() -> &'static str {
183 "sh.weaver.embed.records"
184 }
185 fn def_name() -> &'static str {
186 "main"
187 }
188 fn lexicon_doc() -> LexiconDoc<'static> {
189 lexicon_doc_sh_weaver_embed_records()
190 }
191 fn validate(&self) -> Result<(), ConstraintError> {
192 {
193 let value = &self.records;
194 #[allow(unused_comparisons)]
195 if value.len() > 48usize {
196 return Err(ConstraintError::MaxLength {
197 path: ValidationPath::from_field("records"),
198 max: 48usize,
199 actual: value.len(),
200 });
201 }
202 }
203 Ok(())
204 }
205}
206
207impl<'a> LexiconSchema for RecordEmbed<'a> {
208 fn nsid() -> &'static str {
209 "sh.weaver.embed.records"
210 }
211 fn def_name() -> &'static str {
212 "recordEmbed"
213 }
214 fn lexicon_doc() -> LexiconDoc<'static> {
215 lexicon_doc_sh_weaver_embed_records()
216 }
217 fn validate(&self) -> Result<(), ConstraintError> {
218 if let Some(ref value) = self.name {
219 #[allow(unused_comparisons)]
220 if <str>::len(value.as_ref()) > 128usize {
221 return Err(ConstraintError::MaxLength {
222 path: ValidationPath::from_field("name"),
223 max: 128usize,
224 actual: <str>::len(value.as_ref()),
225 });
226 }
227 }
228 Ok(())
229 }
230}
231
232impl<'a> LexiconSchema for RecordEmbedView<'a> {
233 fn nsid() -> &'static str {
234 "sh.weaver.embed.records"
235 }
236 fn def_name() -> &'static str {
237 "recordEmbedView"
238 }
239 fn lexicon_doc() -> LexiconDoc<'static> {
240 lexicon_doc_sh_weaver_embed_records()
241 }
242 fn validate(&self) -> Result<(), ConstraintError> {
243 if let Some(ref value) = self.name {
244 #[allow(unused_comparisons)]
245 if <str>::len(value.as_ref()) > 128usize {
246 return Err(ConstraintError::MaxLength {
247 path: ValidationPath::from_field("name"),
248 max: 128usize,
249 actual: <str>::len(value.as_ref()),
250 });
251 }
252 }
253 Ok(())
254 }
255}
256
257impl<'a> LexiconSchema for View<'a> {
258 fn nsid() -> &'static str {
259 "sh.weaver.embed.records"
260 }
261 fn def_name() -> &'static str {
262 "view"
263 }
264 fn lexicon_doc() -> LexiconDoc<'static> {
265 lexicon_doc_sh_weaver_embed_records()
266 }
267 fn validate(&self) -> Result<(), ConstraintError> {
268 Ok(())
269 }
270}
271
272impl<'a> LexiconSchema for ViewBlocked<'a> {
273 fn nsid() -> &'static str {
274 "sh.weaver.embed.records"
275 }
276 fn def_name() -> &'static str {
277 "viewBlocked"
278 }
279 fn lexicon_doc() -> LexiconDoc<'static> {
280 lexicon_doc_sh_weaver_embed_records()
281 }
282 fn validate(&self) -> Result<(), ConstraintError> {
283 Ok(())
284 }
285}
286
287impl<'a> LexiconSchema for ViewDetached<'a> {
288 fn nsid() -> &'static str {
289 "sh.weaver.embed.records"
290 }
291 fn def_name() -> &'static str {
292 "viewDetached"
293 }
294 fn lexicon_doc() -> LexiconDoc<'static> {
295 lexicon_doc_sh_weaver_embed_records()
296 }
297 fn validate(&self) -> Result<(), ConstraintError> {
298 Ok(())
299 }
300}
301
302impl<'a> LexiconSchema for ViewNotFound<'a> {
303 fn nsid() -> &'static str {
304 "sh.weaver.embed.records"
305 }
306 fn def_name() -> &'static str {
307 "viewNotFound"
308 }
309 fn lexicon_doc() -> LexiconDoc<'static> {
310 lexicon_doc_sh_weaver_embed_records()
311 }
312 fn validate(&self) -> Result<(), ConstraintError> {
313 Ok(())
314 }
315}
316
317impl<'a> LexiconSchema for ViewRecord<'a> {
318 fn nsid() -> &'static str {
319 "sh.weaver.embed.records"
320 }
321 fn def_name() -> &'static str {
322 "viewRecord"
323 }
324 fn lexicon_doc() -> LexiconDoc<'static> {
325 lexicon_doc_sh_weaver_embed_records()
326 }
327 fn validate(&self) -> Result<(), ConstraintError> {
328 Ok(())
329 }
330}
331
332pub mod records_state {
333
334 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
335 #[allow(unused)]
336 use ::core::marker::PhantomData;
337 mod sealed {
338 pub trait Sealed {}
339 }
340 pub trait State: sealed::Sealed {
342 type Records;
343 }
344 pub struct Empty(());
346 impl sealed::Sealed for Empty {}
347 impl State for Empty {
348 type Records = Unset;
349 }
350 pub struct SetRecords<S: State = Empty>(PhantomData<fn() -> S>);
352 impl<S: State> sealed::Sealed for SetRecords<S> {}
353 impl<S: State> State for SetRecords<S> {
354 type Records = Set<members::records>;
355 }
356 #[allow(non_camel_case_types)]
358 pub mod members {
359 pub struct records(());
361 }
362}
363
364pub struct RecordsBuilder<'a, S: records_state::State> {
366 _state: PhantomData<fn() -> S>,
367 _fields: (Option<Vec<records::RecordEmbed<'a>>>,),
368 _lifetime: PhantomData<&'a ()>,
369}
370
371impl<'a> Records<'a> {
372 pub fn new() -> RecordsBuilder<'a, records_state::Empty> {
374 RecordsBuilder::new()
375 }
376}
377
378impl<'a> RecordsBuilder<'a, records_state::Empty> {
379 pub fn new() -> Self {
381 RecordsBuilder {
382 _state: PhantomData,
383 _fields: (None,),
384 _lifetime: PhantomData,
385 }
386 }
387}
388
389impl<'a, S> RecordsBuilder<'a, S>
390where
391 S: records_state::State,
392 S::Records: records_state::IsUnset,
393{
394 pub fn records(
396 mut self,
397 value: impl Into<Vec<records::RecordEmbed<'a>>>,
398 ) -> RecordsBuilder<'a, records_state::SetRecords<S>> {
399 self._fields.0 = Option::Some(value.into());
400 RecordsBuilder {
401 _state: PhantomData,
402 _fields: self._fields,
403 _lifetime: PhantomData,
404 }
405 }
406}
407
408impl<'a, S> RecordsBuilder<'a, S>
409where
410 S: records_state::State,
411 S::Records: records_state::IsSet,
412{
413 pub fn build(self) -> Records<'a> {
415 Records {
416 records: self._fields.0.unwrap(),
417 extra_data: Default::default(),
418 }
419 }
420 pub fn build_with_data(
422 self,
423 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
424 ) -> Records<'a> {
425 Records {
426 records: self._fields.0.unwrap(),
427 extra_data: Some(extra_data),
428 }
429 }
430}
431
432fn lexicon_doc_sh_weaver_embed_records() -> LexiconDoc<'static> {
433 #[allow(unused_imports)]
434 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
435 use jacquard_lexicon::lexicon::*;
436 use alloc::collections::BTreeMap;
437 LexiconDoc {
438 lexicon: Lexicon::Lexicon1,
439 id: CowStr::new_static("sh.weaver.embed.records"),
440 defs: {
441 let mut map = BTreeMap::new();
442 map.insert(
443 SmolStr::new_static("main"),
444 LexUserType::Object(LexObject {
445 required: Some(vec![SmolStr::new_static("records")]),
446 properties: {
447 #[allow(unused_mut)]
448 let mut map = BTreeMap::new();
449 map.insert(
450 SmolStr::new_static("records"),
451 LexObjectProperty::Array(LexArray {
452 items: LexArrayItem::Ref(LexRef {
453 r#ref: CowStr::new_static("#recordEmbed"),
454 ..Default::default()
455 }),
456 max_length: Some(48usize),
457 ..Default::default()
458 }),
459 );
460 map
461 },
462 ..Default::default()
463 }),
464 );
465 map.insert(
466 SmolStr::new_static("recordEmbed"),
467 LexUserType::Object(LexObject {
468 required: Some(vec![SmolStr::new_static("record")]),
469 properties: {
470 #[allow(unused_mut)]
471 let mut map = BTreeMap::new();
472 map.insert(
473 SmolStr::new_static("name"),
474 LexObjectProperty::String(LexString {
475 max_length: Some(128usize),
476 ..Default::default()
477 }),
478 );
479 map.insert(
480 SmolStr::new_static("record"),
481 LexObjectProperty::Ref(LexRef {
482 r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
483 ..Default::default()
484 }),
485 );
486 map
487 },
488 ..Default::default()
489 }),
490 );
491 map.insert(
492 SmolStr::new_static("recordEmbedView"),
493 LexUserType::Object(LexObject {
494 required: Some(vec![SmolStr::new_static("recordView")]),
495 properties: {
496 #[allow(unused_mut)]
497 let mut map = BTreeMap::new();
498 map.insert(
499 SmolStr::new_static("name"),
500 LexObjectProperty::String(LexString {
501 max_length: Some(128usize),
502 ..Default::default()
503 }),
504 );
505 map.insert(
506 SmolStr::new_static("recordView"),
507 LexObjectProperty::Union(LexRefUnion {
508 refs: vec![
509 CowStr::new_static("sh.weaver.embed.records#view"),
510 CowStr::new_static("sh.weaver.embed.images#view"),
511 CowStr::new_static("sh.weaver.embed.recordWithMedia#view"),
512 CowStr::new_static("sh.weaver.embed.video#view")
513 ],
514 ..Default::default()
515 }),
516 );
517 map
518 },
519 ..Default::default()
520 }),
521 );
522 map.insert(
523 SmolStr::new_static("view"),
524 LexUserType::Object(LexObject {
525 required: Some(vec![SmolStr::new_static("record")]),
526 properties: {
527 #[allow(unused_mut)]
528 let mut map = BTreeMap::new();
529 map.insert(
530 SmolStr::new_static("record"),
531 LexObjectProperty::Union(LexRefUnion {
532 refs: vec![
533 CowStr::new_static("#viewRecord"),
534 CowStr::new_static("#viewNotFound"),
535 CowStr::new_static("#viewBlocked"),
536 CowStr::new_static("#viewDetached"),
537 CowStr::new_static("app.bsky.feed.defs#generatorView"),
538 CowStr::new_static("app.bsky.graph.defs#listView"),
539 CowStr::new_static("app.bsky.labeler.defs#labelerView"),
540 CowStr::new_static("app.bsky.graph.defs#starterPackViewBasic")
541 ],
542 ..Default::default()
543 }),
544 );
545 map
546 },
547 ..Default::default()
548 }),
549 );
550 map.insert(
551 SmolStr::new_static("viewBlocked"),
552 LexUserType::Object(LexObject {
553 required: Some(
554 vec![
555 SmolStr::new_static("uri"), SmolStr::new_static("blocked"),
556 SmolStr::new_static("author")
557 ],
558 ),
559 properties: {
560 #[allow(unused_mut)]
561 let mut map = BTreeMap::new();
562 map.insert(
563 SmolStr::new_static("author"),
564 LexObjectProperty::Ref(LexRef {
565 r#ref: CowStr::new_static(
566 "app.bsky.feed.defs#blockedAuthor",
567 ),
568 ..Default::default()
569 }),
570 );
571 map.insert(
572 SmolStr::new_static("blocked"),
573 LexObjectProperty::Boolean(LexBoolean {
574 ..Default::default()
575 }),
576 );
577 map.insert(
578 SmolStr::new_static("uri"),
579 LexObjectProperty::String(LexString {
580 format: Some(LexStringFormat::AtUri),
581 ..Default::default()
582 }),
583 );
584 map
585 },
586 ..Default::default()
587 }),
588 );
589 map.insert(
590 SmolStr::new_static("viewDetached"),
591 LexUserType::Object(LexObject {
592 required: Some(
593 vec![SmolStr::new_static("uri"), SmolStr::new_static("detached")],
594 ),
595 properties: {
596 #[allow(unused_mut)]
597 let mut map = BTreeMap::new();
598 map.insert(
599 SmolStr::new_static("detached"),
600 LexObjectProperty::Boolean(LexBoolean {
601 ..Default::default()
602 }),
603 );
604 map.insert(
605 SmolStr::new_static("uri"),
606 LexObjectProperty::String(LexString {
607 format: Some(LexStringFormat::AtUri),
608 ..Default::default()
609 }),
610 );
611 map
612 },
613 ..Default::default()
614 }),
615 );
616 map.insert(
617 SmolStr::new_static("viewNotFound"),
618 LexUserType::Object(LexObject {
619 required: Some(
620 vec![SmolStr::new_static("uri"), SmolStr::new_static("notFound")],
621 ),
622 properties: {
623 #[allow(unused_mut)]
624 let mut map = BTreeMap::new();
625 map.insert(
626 SmolStr::new_static("notFound"),
627 LexObjectProperty::Boolean(LexBoolean {
628 ..Default::default()
629 }),
630 );
631 map.insert(
632 SmolStr::new_static("uri"),
633 LexObjectProperty::String(LexString {
634 format: Some(LexStringFormat::AtUri),
635 ..Default::default()
636 }),
637 );
638 map
639 },
640 ..Default::default()
641 }),
642 );
643 map.insert(
644 SmolStr::new_static("viewRecord"),
645 LexUserType::Object(LexObject {
646 required: Some(
647 vec![
648 SmolStr::new_static("uri"), SmolStr::new_static("cid"),
649 SmolStr::new_static("author"), SmolStr::new_static("value"),
650 SmolStr::new_static("indexedAt")
651 ],
652 ),
653 properties: {
654 #[allow(unused_mut)]
655 let mut map = BTreeMap::new();
656 map.insert(
657 SmolStr::new_static("author"),
658 LexObjectProperty::Ref(LexRef {
659 r#ref: CowStr::new_static(
660 "sh.weaver.actor.defs#profileDataViewBasic",
661 ),
662 ..Default::default()
663 }),
664 );
665 map.insert(
666 SmolStr::new_static("cid"),
667 LexObjectProperty::String(LexString {
668 format: Some(LexStringFormat::Cid),
669 ..Default::default()
670 }),
671 );
672 map.insert(
673 SmolStr::new_static("embeds"),
674 LexObjectProperty::Array(LexArray {
675 items: LexArrayItem::Ref(LexRef {
676 r#ref: CowStr::new_static("#recordEmbedView"),
677 ..Default::default()
678 }),
679 ..Default::default()
680 }),
681 );
682 map.insert(
683 SmolStr::new_static("indexedAt"),
684 LexObjectProperty::String(LexString {
685 format: Some(LexStringFormat::Datetime),
686 ..Default::default()
687 }),
688 );
689 map.insert(
690 SmolStr::new_static("labels"),
691 LexObjectProperty::Array(LexArray {
692 items: LexArrayItem::Ref(LexRef {
693 r#ref: CowStr::new_static("com.atproto.label.defs#label"),
694 ..Default::default()
695 }),
696 ..Default::default()
697 }),
698 );
699 map.insert(
700 SmolStr::new_static("likeCount"),
701 LexObjectProperty::Integer(LexInteger {
702 ..Default::default()
703 }),
704 );
705 map.insert(
706 SmolStr::new_static("quoteCount"),
707 LexObjectProperty::Integer(LexInteger {
708 ..Default::default()
709 }),
710 );
711 map.insert(
712 SmolStr::new_static("replyCount"),
713 LexObjectProperty::Integer(LexInteger {
714 ..Default::default()
715 }),
716 );
717 map.insert(
718 SmolStr::new_static("repostCount"),
719 LexObjectProperty::Integer(LexInteger {
720 ..Default::default()
721 }),
722 );
723 map.insert(
724 SmolStr::new_static("uri"),
725 LexObjectProperty::String(LexString {
726 format: Some(LexStringFormat::AtUri),
727 ..Default::default()
728 }),
729 );
730 map.insert(
731 SmolStr::new_static("value"),
732 LexObjectProperty::Unknown(LexUnknown {
733 ..Default::default()
734 }),
735 );
736 map
737 },
738 ..Default::default()
739 }),
740 );
741 map
742 },
743 ..Default::default()
744 }
745}
746
747pub mod record_embed_state {
748
749 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
750 #[allow(unused)]
751 use ::core::marker::PhantomData;
752 mod sealed {
753 pub trait Sealed {}
754 }
755 pub trait State: sealed::Sealed {
757 type Record;
758 }
759 pub struct Empty(());
761 impl sealed::Sealed for Empty {}
762 impl State for Empty {
763 type Record = Unset;
764 }
765 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
767 impl<S: State> sealed::Sealed for SetRecord<S> {}
768 impl<S: State> State for SetRecord<S> {
769 type Record = Set<members::record>;
770 }
771 #[allow(non_camel_case_types)]
773 pub mod members {
774 pub struct record(());
776 }
777}
778
779pub struct RecordEmbedBuilder<'a, S: record_embed_state::State> {
781 _state: PhantomData<fn() -> S>,
782 _fields: (Option<CowStr<'a>>, Option<StrongRef<'a>>),
783 _lifetime: PhantomData<&'a ()>,
784}
785
786impl<'a> RecordEmbed<'a> {
787 pub fn new() -> RecordEmbedBuilder<'a, record_embed_state::Empty> {
789 RecordEmbedBuilder::new()
790 }
791}
792
793impl<'a> RecordEmbedBuilder<'a, record_embed_state::Empty> {
794 pub fn new() -> Self {
796 RecordEmbedBuilder {
797 _state: PhantomData,
798 _fields: (None, None),
799 _lifetime: PhantomData,
800 }
801 }
802}
803
804impl<'a, S: record_embed_state::State> RecordEmbedBuilder<'a, S> {
805 pub fn name(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
807 self._fields.0 = value.into();
808 self
809 }
810 pub fn maybe_name(mut self, value: Option<CowStr<'a>>) -> Self {
812 self._fields.0 = value;
813 self
814 }
815}
816
817impl<'a, S> RecordEmbedBuilder<'a, S>
818where
819 S: record_embed_state::State,
820 S::Record: record_embed_state::IsUnset,
821{
822 pub fn record(
824 mut self,
825 value: impl Into<StrongRef<'a>>,
826 ) -> RecordEmbedBuilder<'a, record_embed_state::SetRecord<S>> {
827 self._fields.1 = Option::Some(value.into());
828 RecordEmbedBuilder {
829 _state: PhantomData,
830 _fields: self._fields,
831 _lifetime: PhantomData,
832 }
833 }
834}
835
836impl<'a, S> RecordEmbedBuilder<'a, S>
837where
838 S: record_embed_state::State,
839 S::Record: record_embed_state::IsSet,
840{
841 pub fn build(self) -> RecordEmbed<'a> {
843 RecordEmbed {
844 name: self._fields.0,
845 record: self._fields.1.unwrap(),
846 extra_data: Default::default(),
847 }
848 }
849 pub fn build_with_data(
851 self,
852 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
853 ) -> RecordEmbed<'a> {
854 RecordEmbed {
855 name: self._fields.0,
856 record: self._fields.1.unwrap(),
857 extra_data: Some(extra_data),
858 }
859 }
860}
861
862pub mod record_embed_view_state {
863
864 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
865 #[allow(unused)]
866 use ::core::marker::PhantomData;
867 mod sealed {
868 pub trait Sealed {}
869 }
870 pub trait State: sealed::Sealed {
872 type RecordView;
873 }
874 pub struct Empty(());
876 impl sealed::Sealed for Empty {}
877 impl State for Empty {
878 type RecordView = Unset;
879 }
880 pub struct SetRecordView<S: State = Empty>(PhantomData<fn() -> S>);
882 impl<S: State> sealed::Sealed for SetRecordView<S> {}
883 impl<S: State> State for SetRecordView<S> {
884 type RecordView = Set<members::record_view>;
885 }
886 #[allow(non_camel_case_types)]
888 pub mod members {
889 pub struct record_view(());
891 }
892}
893
894pub struct RecordEmbedViewBuilder<'a, S: record_embed_view_state::State> {
896 _state: PhantomData<fn() -> S>,
897 _fields: (Option<CowStr<'a>>, Option<RecordEmbedViewRecordView<'a>>),
898 _lifetime: PhantomData<&'a ()>,
899}
900
901impl<'a> RecordEmbedView<'a> {
902 pub fn new() -> RecordEmbedViewBuilder<'a, record_embed_view_state::Empty> {
904 RecordEmbedViewBuilder::new()
905 }
906}
907
908impl<'a> RecordEmbedViewBuilder<'a, record_embed_view_state::Empty> {
909 pub fn new() -> Self {
911 RecordEmbedViewBuilder {
912 _state: PhantomData,
913 _fields: (None, None),
914 _lifetime: PhantomData,
915 }
916 }
917}
918
919impl<'a, S: record_embed_view_state::State> RecordEmbedViewBuilder<'a, S> {
920 pub fn name(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
922 self._fields.0 = value.into();
923 self
924 }
925 pub fn maybe_name(mut self, value: Option<CowStr<'a>>) -> Self {
927 self._fields.0 = value;
928 self
929 }
930}
931
932impl<'a, S> RecordEmbedViewBuilder<'a, S>
933where
934 S: record_embed_view_state::State,
935 S::RecordView: record_embed_view_state::IsUnset,
936{
937 pub fn record_view(
939 mut self,
940 value: impl Into<RecordEmbedViewRecordView<'a>>,
941 ) -> RecordEmbedViewBuilder<'a, record_embed_view_state::SetRecordView<S>> {
942 self._fields.1 = Option::Some(value.into());
943 RecordEmbedViewBuilder {
944 _state: PhantomData,
945 _fields: self._fields,
946 _lifetime: PhantomData,
947 }
948 }
949}
950
951impl<'a, S> RecordEmbedViewBuilder<'a, S>
952where
953 S: record_embed_view_state::State,
954 S::RecordView: record_embed_view_state::IsSet,
955{
956 pub fn build(self) -> RecordEmbedView<'a> {
958 RecordEmbedView {
959 name: self._fields.0,
960 record_view: self._fields.1.unwrap(),
961 extra_data: Default::default(),
962 }
963 }
964 pub fn build_with_data(
966 self,
967 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
968 ) -> RecordEmbedView<'a> {
969 RecordEmbedView {
970 name: self._fields.0,
971 record_view: self._fields.1.unwrap(),
972 extra_data: Some(extra_data),
973 }
974 }
975}
976
977pub mod view_state {
978
979 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
980 #[allow(unused)]
981 use ::core::marker::PhantomData;
982 mod sealed {
983 pub trait Sealed {}
984 }
985 pub trait State: sealed::Sealed {
987 type Record;
988 }
989 pub struct Empty(());
991 impl sealed::Sealed for Empty {}
992 impl State for Empty {
993 type Record = Unset;
994 }
995 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
997 impl<S: State> sealed::Sealed for SetRecord<S> {}
998 impl<S: State> State for SetRecord<S> {
999 type Record = Set<members::record>;
1000 }
1001 #[allow(non_camel_case_types)]
1003 pub mod members {
1004 pub struct record(());
1006 }
1007}
1008
1009pub struct ViewBuilder<'a, S: view_state::State> {
1011 _state: PhantomData<fn() -> S>,
1012 _fields: (Option<ViewUnionRecord<'a>>,),
1013 _lifetime: PhantomData<&'a ()>,
1014}
1015
1016impl<'a> View<'a> {
1017 pub fn new() -> ViewBuilder<'a, view_state::Empty> {
1019 ViewBuilder::new()
1020 }
1021}
1022
1023impl<'a> ViewBuilder<'a, view_state::Empty> {
1024 pub fn new() -> Self {
1026 ViewBuilder {
1027 _state: PhantomData,
1028 _fields: (None,),
1029 _lifetime: PhantomData,
1030 }
1031 }
1032}
1033
1034impl<'a, S> ViewBuilder<'a, S>
1035where
1036 S: view_state::State,
1037 S::Record: view_state::IsUnset,
1038{
1039 pub fn record(
1041 mut self,
1042 value: impl Into<ViewUnionRecord<'a>>,
1043 ) -> ViewBuilder<'a, view_state::SetRecord<S>> {
1044 self._fields.0 = Option::Some(value.into());
1045 ViewBuilder {
1046 _state: PhantomData,
1047 _fields: self._fields,
1048 _lifetime: PhantomData,
1049 }
1050 }
1051}
1052
1053impl<'a, S> ViewBuilder<'a, S>
1054where
1055 S: view_state::State,
1056 S::Record: view_state::IsSet,
1057{
1058 pub fn build(self) -> View<'a> {
1060 View {
1061 record: self._fields.0.unwrap(),
1062 extra_data: Default::default(),
1063 }
1064 }
1065 pub fn build_with_data(
1067 self,
1068 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1069 ) -> View<'a> {
1070 View {
1071 record: self._fields.0.unwrap(),
1072 extra_data: Some(extra_data),
1073 }
1074 }
1075}
1076
1077pub mod view_blocked_state {
1078
1079 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1080 #[allow(unused)]
1081 use ::core::marker::PhantomData;
1082 mod sealed {
1083 pub trait Sealed {}
1084 }
1085 pub trait State: sealed::Sealed {
1087 type Author;
1088 type Uri;
1089 type Blocked;
1090 }
1091 pub struct Empty(());
1093 impl sealed::Sealed for Empty {}
1094 impl State for Empty {
1095 type Author = Unset;
1096 type Uri = Unset;
1097 type Blocked = Unset;
1098 }
1099 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
1101 impl<S: State> sealed::Sealed for SetAuthor<S> {}
1102 impl<S: State> State for SetAuthor<S> {
1103 type Author = Set<members::author>;
1104 type Uri = S::Uri;
1105 type Blocked = S::Blocked;
1106 }
1107 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
1109 impl<S: State> sealed::Sealed for SetUri<S> {}
1110 impl<S: State> State for SetUri<S> {
1111 type Author = S::Author;
1112 type Uri = Set<members::uri>;
1113 type Blocked = S::Blocked;
1114 }
1115 pub struct SetBlocked<S: State = Empty>(PhantomData<fn() -> S>);
1117 impl<S: State> sealed::Sealed for SetBlocked<S> {}
1118 impl<S: State> State for SetBlocked<S> {
1119 type Author = S::Author;
1120 type Uri = S::Uri;
1121 type Blocked = Set<members::blocked>;
1122 }
1123 #[allow(non_camel_case_types)]
1125 pub mod members {
1126 pub struct author(());
1128 pub struct uri(());
1130 pub struct blocked(());
1132 }
1133}
1134
1135pub struct ViewBlockedBuilder<'a, S: view_blocked_state::State> {
1137 _state: PhantomData<fn() -> S>,
1138 _fields: (Option<BlockedAuthor<'a>>, Option<bool>, Option<AtUri<'a>>),
1139 _lifetime: PhantomData<&'a ()>,
1140}
1141
1142impl<'a> ViewBlocked<'a> {
1143 pub fn new() -> ViewBlockedBuilder<'a, view_blocked_state::Empty> {
1145 ViewBlockedBuilder::new()
1146 }
1147}
1148
1149impl<'a> ViewBlockedBuilder<'a, view_blocked_state::Empty> {
1150 pub fn new() -> Self {
1152 ViewBlockedBuilder {
1153 _state: PhantomData,
1154 _fields: (None, None, None),
1155 _lifetime: PhantomData,
1156 }
1157 }
1158}
1159
1160impl<'a, S> ViewBlockedBuilder<'a, S>
1161where
1162 S: view_blocked_state::State,
1163 S::Author: view_blocked_state::IsUnset,
1164{
1165 pub fn author(
1167 mut self,
1168 value: impl Into<BlockedAuthor<'a>>,
1169 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetAuthor<S>> {
1170 self._fields.0 = Option::Some(value.into());
1171 ViewBlockedBuilder {
1172 _state: PhantomData,
1173 _fields: self._fields,
1174 _lifetime: PhantomData,
1175 }
1176 }
1177}
1178
1179impl<'a, S> ViewBlockedBuilder<'a, S>
1180where
1181 S: view_blocked_state::State,
1182 S::Blocked: view_blocked_state::IsUnset,
1183{
1184 pub fn blocked(
1186 mut self,
1187 value: impl Into<bool>,
1188 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetBlocked<S>> {
1189 self._fields.1 = Option::Some(value.into());
1190 ViewBlockedBuilder {
1191 _state: PhantomData,
1192 _fields: self._fields,
1193 _lifetime: PhantomData,
1194 }
1195 }
1196}
1197
1198impl<'a, S> ViewBlockedBuilder<'a, S>
1199where
1200 S: view_blocked_state::State,
1201 S::Uri: view_blocked_state::IsUnset,
1202{
1203 pub fn uri(
1205 mut self,
1206 value: impl Into<AtUri<'a>>,
1207 ) -> ViewBlockedBuilder<'a, view_blocked_state::SetUri<S>> {
1208 self._fields.2 = Option::Some(value.into());
1209 ViewBlockedBuilder {
1210 _state: PhantomData,
1211 _fields: self._fields,
1212 _lifetime: PhantomData,
1213 }
1214 }
1215}
1216
1217impl<'a, S> ViewBlockedBuilder<'a, S>
1218where
1219 S: view_blocked_state::State,
1220 S::Author: view_blocked_state::IsSet,
1221 S::Uri: view_blocked_state::IsSet,
1222 S::Blocked: view_blocked_state::IsSet,
1223{
1224 pub fn build(self) -> ViewBlocked<'a> {
1226 ViewBlocked {
1227 author: self._fields.0.unwrap(),
1228 blocked: self._fields.1.unwrap(),
1229 uri: self._fields.2.unwrap(),
1230 extra_data: Default::default(),
1231 }
1232 }
1233 pub fn build_with_data(
1235 self,
1236 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1237 ) -> ViewBlocked<'a> {
1238 ViewBlocked {
1239 author: self._fields.0.unwrap(),
1240 blocked: self._fields.1.unwrap(),
1241 uri: self._fields.2.unwrap(),
1242 extra_data: Some(extra_data),
1243 }
1244 }
1245}
1246
1247pub mod view_detached_state {
1248
1249 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1250 #[allow(unused)]
1251 use ::core::marker::PhantomData;
1252 mod sealed {
1253 pub trait Sealed {}
1254 }
1255 pub trait State: sealed::Sealed {
1257 type Uri;
1258 type Detached;
1259 }
1260 pub struct Empty(());
1262 impl sealed::Sealed for Empty {}
1263 impl State for Empty {
1264 type Uri = Unset;
1265 type Detached = Unset;
1266 }
1267 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
1269 impl<S: State> sealed::Sealed for SetUri<S> {}
1270 impl<S: State> State for SetUri<S> {
1271 type Uri = Set<members::uri>;
1272 type Detached = S::Detached;
1273 }
1274 pub struct SetDetached<S: State = Empty>(PhantomData<fn() -> S>);
1276 impl<S: State> sealed::Sealed for SetDetached<S> {}
1277 impl<S: State> State for SetDetached<S> {
1278 type Uri = S::Uri;
1279 type Detached = Set<members::detached>;
1280 }
1281 #[allow(non_camel_case_types)]
1283 pub mod members {
1284 pub struct uri(());
1286 pub struct detached(());
1288 }
1289}
1290
1291pub struct ViewDetachedBuilder<'a, S: view_detached_state::State> {
1293 _state: PhantomData<fn() -> S>,
1294 _fields: (Option<bool>, Option<AtUri<'a>>),
1295 _lifetime: PhantomData<&'a ()>,
1296}
1297
1298impl<'a> ViewDetached<'a> {
1299 pub fn new() -> ViewDetachedBuilder<'a, view_detached_state::Empty> {
1301 ViewDetachedBuilder::new()
1302 }
1303}
1304
1305impl<'a> ViewDetachedBuilder<'a, view_detached_state::Empty> {
1306 pub fn new() -> Self {
1308 ViewDetachedBuilder {
1309 _state: PhantomData,
1310 _fields: (None, None),
1311 _lifetime: PhantomData,
1312 }
1313 }
1314}
1315
1316impl<'a, S> ViewDetachedBuilder<'a, S>
1317where
1318 S: view_detached_state::State,
1319 S::Detached: view_detached_state::IsUnset,
1320{
1321 pub fn detached(
1323 mut self,
1324 value: impl Into<bool>,
1325 ) -> ViewDetachedBuilder<'a, view_detached_state::SetDetached<S>> {
1326 self._fields.0 = Option::Some(value.into());
1327 ViewDetachedBuilder {
1328 _state: PhantomData,
1329 _fields: self._fields,
1330 _lifetime: PhantomData,
1331 }
1332 }
1333}
1334
1335impl<'a, S> ViewDetachedBuilder<'a, S>
1336where
1337 S: view_detached_state::State,
1338 S::Uri: view_detached_state::IsUnset,
1339{
1340 pub fn uri(
1342 mut self,
1343 value: impl Into<AtUri<'a>>,
1344 ) -> ViewDetachedBuilder<'a, view_detached_state::SetUri<S>> {
1345 self._fields.1 = Option::Some(value.into());
1346 ViewDetachedBuilder {
1347 _state: PhantomData,
1348 _fields: self._fields,
1349 _lifetime: PhantomData,
1350 }
1351 }
1352}
1353
1354impl<'a, S> ViewDetachedBuilder<'a, S>
1355where
1356 S: view_detached_state::State,
1357 S::Uri: view_detached_state::IsSet,
1358 S::Detached: view_detached_state::IsSet,
1359{
1360 pub fn build(self) -> ViewDetached<'a> {
1362 ViewDetached {
1363 detached: self._fields.0.unwrap(),
1364 uri: self._fields.1.unwrap(),
1365 extra_data: Default::default(),
1366 }
1367 }
1368 pub fn build_with_data(
1370 self,
1371 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1372 ) -> ViewDetached<'a> {
1373 ViewDetached {
1374 detached: self._fields.0.unwrap(),
1375 uri: self._fields.1.unwrap(),
1376 extra_data: Some(extra_data),
1377 }
1378 }
1379}
1380
1381pub mod view_not_found_state {
1382
1383 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1384 #[allow(unused)]
1385 use ::core::marker::PhantomData;
1386 mod sealed {
1387 pub trait Sealed {}
1388 }
1389 pub trait State: sealed::Sealed {
1391 type NotFound;
1392 type Uri;
1393 }
1394 pub struct Empty(());
1396 impl sealed::Sealed for Empty {}
1397 impl State for Empty {
1398 type NotFound = Unset;
1399 type Uri = Unset;
1400 }
1401 pub struct SetNotFound<S: State = Empty>(PhantomData<fn() -> S>);
1403 impl<S: State> sealed::Sealed for SetNotFound<S> {}
1404 impl<S: State> State for SetNotFound<S> {
1405 type NotFound = Set<members::not_found>;
1406 type Uri = S::Uri;
1407 }
1408 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
1410 impl<S: State> sealed::Sealed for SetUri<S> {}
1411 impl<S: State> State for SetUri<S> {
1412 type NotFound = S::NotFound;
1413 type Uri = Set<members::uri>;
1414 }
1415 #[allow(non_camel_case_types)]
1417 pub mod members {
1418 pub struct not_found(());
1420 pub struct uri(());
1422 }
1423}
1424
1425pub struct ViewNotFoundBuilder<'a, S: view_not_found_state::State> {
1427 _state: PhantomData<fn() -> S>,
1428 _fields: (Option<bool>, Option<AtUri<'a>>),
1429 _lifetime: PhantomData<&'a ()>,
1430}
1431
1432impl<'a> ViewNotFound<'a> {
1433 pub fn new() -> ViewNotFoundBuilder<'a, view_not_found_state::Empty> {
1435 ViewNotFoundBuilder::new()
1436 }
1437}
1438
1439impl<'a> ViewNotFoundBuilder<'a, view_not_found_state::Empty> {
1440 pub fn new() -> Self {
1442 ViewNotFoundBuilder {
1443 _state: PhantomData,
1444 _fields: (None, None),
1445 _lifetime: PhantomData,
1446 }
1447 }
1448}
1449
1450impl<'a, S> ViewNotFoundBuilder<'a, S>
1451where
1452 S: view_not_found_state::State,
1453 S::NotFound: view_not_found_state::IsUnset,
1454{
1455 pub fn not_found(
1457 mut self,
1458 value: impl Into<bool>,
1459 ) -> ViewNotFoundBuilder<'a, view_not_found_state::SetNotFound<S>> {
1460 self._fields.0 = Option::Some(value.into());
1461 ViewNotFoundBuilder {
1462 _state: PhantomData,
1463 _fields: self._fields,
1464 _lifetime: PhantomData,
1465 }
1466 }
1467}
1468
1469impl<'a, S> ViewNotFoundBuilder<'a, S>
1470where
1471 S: view_not_found_state::State,
1472 S::Uri: view_not_found_state::IsUnset,
1473{
1474 pub fn uri(
1476 mut self,
1477 value: impl Into<AtUri<'a>>,
1478 ) -> ViewNotFoundBuilder<'a, view_not_found_state::SetUri<S>> {
1479 self._fields.1 = Option::Some(value.into());
1480 ViewNotFoundBuilder {
1481 _state: PhantomData,
1482 _fields: self._fields,
1483 _lifetime: PhantomData,
1484 }
1485 }
1486}
1487
1488impl<'a, S> ViewNotFoundBuilder<'a, S>
1489where
1490 S: view_not_found_state::State,
1491 S::NotFound: view_not_found_state::IsSet,
1492 S::Uri: view_not_found_state::IsSet,
1493{
1494 pub fn build(self) -> ViewNotFound<'a> {
1496 ViewNotFound {
1497 not_found: self._fields.0.unwrap(),
1498 uri: self._fields.1.unwrap(),
1499 extra_data: Default::default(),
1500 }
1501 }
1502 pub fn build_with_data(
1504 self,
1505 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1506 ) -> ViewNotFound<'a> {
1507 ViewNotFound {
1508 not_found: self._fields.0.unwrap(),
1509 uri: self._fields.1.unwrap(),
1510 extra_data: Some(extra_data),
1511 }
1512 }
1513}
1514
1515pub mod view_record_state {
1516
1517 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1518 #[allow(unused)]
1519 use ::core::marker::PhantomData;
1520 mod sealed {
1521 pub trait Sealed {}
1522 }
1523 pub trait State: sealed::Sealed {
1525 type Author;
1526 type IndexedAt;
1527 type Uri;
1528 type Cid;
1529 type Value;
1530 }
1531 pub struct Empty(());
1533 impl sealed::Sealed for Empty {}
1534 impl State for Empty {
1535 type Author = Unset;
1536 type IndexedAt = Unset;
1537 type Uri = Unset;
1538 type Cid = Unset;
1539 type Value = Unset;
1540 }
1541 pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
1543 impl<S: State> sealed::Sealed for SetAuthor<S> {}
1544 impl<S: State> State for SetAuthor<S> {
1545 type Author = Set<members::author>;
1546 type IndexedAt = S::IndexedAt;
1547 type Uri = S::Uri;
1548 type Cid = S::Cid;
1549 type Value = S::Value;
1550 }
1551 pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
1553 impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
1554 impl<S: State> State for SetIndexedAt<S> {
1555 type Author = S::Author;
1556 type IndexedAt = Set<members::indexed_at>;
1557 type Uri = S::Uri;
1558 type Cid = S::Cid;
1559 type Value = S::Value;
1560 }
1561 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
1563 impl<S: State> sealed::Sealed for SetUri<S> {}
1564 impl<S: State> State for SetUri<S> {
1565 type Author = S::Author;
1566 type IndexedAt = S::IndexedAt;
1567 type Uri = Set<members::uri>;
1568 type Cid = S::Cid;
1569 type Value = S::Value;
1570 }
1571 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
1573 impl<S: State> sealed::Sealed for SetCid<S> {}
1574 impl<S: State> State for SetCid<S> {
1575 type Author = S::Author;
1576 type IndexedAt = S::IndexedAt;
1577 type Uri = S::Uri;
1578 type Cid = Set<members::cid>;
1579 type Value = S::Value;
1580 }
1581 pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
1583 impl<S: State> sealed::Sealed for SetValue<S> {}
1584 impl<S: State> State for SetValue<S> {
1585 type Author = S::Author;
1586 type IndexedAt = S::IndexedAt;
1587 type Uri = S::Uri;
1588 type Cid = S::Cid;
1589 type Value = Set<members::value>;
1590 }
1591 #[allow(non_camel_case_types)]
1593 pub mod members {
1594 pub struct author(());
1596 pub struct indexed_at(());
1598 pub struct uri(());
1600 pub struct cid(());
1602 pub struct value(());
1604 }
1605}
1606
1607pub struct ViewRecordBuilder<'a, S: view_record_state::State> {
1609 _state: PhantomData<fn() -> S>,
1610 _fields: (
1611 Option<ProfileDataViewBasic<'a>>,
1612 Option<Cid<'a>>,
1613 Option<Vec<records::RecordEmbedView<'a>>>,
1614 Option<Datetime>,
1615 Option<Vec<Label<'a>>>,
1616 Option<i64>,
1617 Option<i64>,
1618 Option<i64>,
1619 Option<i64>,
1620 Option<AtUri<'a>>,
1621 Option<Data<'a>>,
1622 ),
1623 _lifetime: PhantomData<&'a ()>,
1624}
1625
1626impl<'a> ViewRecord<'a> {
1627 pub fn new() -> ViewRecordBuilder<'a, view_record_state::Empty> {
1629 ViewRecordBuilder::new()
1630 }
1631}
1632
1633impl<'a> ViewRecordBuilder<'a, view_record_state::Empty> {
1634 pub fn new() -> Self {
1636 ViewRecordBuilder {
1637 _state: PhantomData,
1638 _fields: (None, None, None, None, None, None, None, None, None, None, None),
1639 _lifetime: PhantomData,
1640 }
1641 }
1642}
1643
1644impl<'a, S> ViewRecordBuilder<'a, S>
1645where
1646 S: view_record_state::State,
1647 S::Author: view_record_state::IsUnset,
1648{
1649 pub fn author(
1651 mut self,
1652 value: impl Into<ProfileDataViewBasic<'a>>,
1653 ) -> ViewRecordBuilder<'a, view_record_state::SetAuthor<S>> {
1654 self._fields.0 = Option::Some(value.into());
1655 ViewRecordBuilder {
1656 _state: PhantomData,
1657 _fields: self._fields,
1658 _lifetime: PhantomData,
1659 }
1660 }
1661}
1662
1663impl<'a, S> ViewRecordBuilder<'a, S>
1664where
1665 S: view_record_state::State,
1666 S::Cid: view_record_state::IsUnset,
1667{
1668 pub fn cid(
1670 mut self,
1671 value: impl Into<Cid<'a>>,
1672 ) -> ViewRecordBuilder<'a, view_record_state::SetCid<S>> {
1673 self._fields.1 = Option::Some(value.into());
1674 ViewRecordBuilder {
1675 _state: PhantomData,
1676 _fields: self._fields,
1677 _lifetime: PhantomData,
1678 }
1679 }
1680}
1681
1682impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1683 pub fn embeds(
1685 mut self,
1686 value: impl Into<Option<Vec<records::RecordEmbedView<'a>>>>,
1687 ) -> Self {
1688 self._fields.2 = value.into();
1689 self
1690 }
1691 pub fn maybe_embeds(
1693 mut self,
1694 value: Option<Vec<records::RecordEmbedView<'a>>>,
1695 ) -> Self {
1696 self._fields.2 = value;
1697 self
1698 }
1699}
1700
1701impl<'a, S> ViewRecordBuilder<'a, S>
1702where
1703 S: view_record_state::State,
1704 S::IndexedAt: view_record_state::IsUnset,
1705{
1706 pub fn indexed_at(
1708 mut self,
1709 value: impl Into<Datetime>,
1710 ) -> ViewRecordBuilder<'a, view_record_state::SetIndexedAt<S>> {
1711 self._fields.3 = Option::Some(value.into());
1712 ViewRecordBuilder {
1713 _state: PhantomData,
1714 _fields: self._fields,
1715 _lifetime: PhantomData,
1716 }
1717 }
1718}
1719
1720impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1721 pub fn labels(mut self, value: impl Into<Option<Vec<Label<'a>>>>) -> Self {
1723 self._fields.4 = value.into();
1724 self
1725 }
1726 pub fn maybe_labels(mut self, value: Option<Vec<Label<'a>>>) -> Self {
1728 self._fields.4 = value;
1729 self
1730 }
1731}
1732
1733impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1734 pub fn like_count(mut self, value: impl Into<Option<i64>>) -> Self {
1736 self._fields.5 = value.into();
1737 self
1738 }
1739 pub fn maybe_like_count(mut self, value: Option<i64>) -> Self {
1741 self._fields.5 = value;
1742 self
1743 }
1744}
1745
1746impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1747 pub fn quote_count(mut self, value: impl Into<Option<i64>>) -> Self {
1749 self._fields.6 = value.into();
1750 self
1751 }
1752 pub fn maybe_quote_count(mut self, value: Option<i64>) -> Self {
1754 self._fields.6 = value;
1755 self
1756 }
1757}
1758
1759impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1760 pub fn reply_count(mut self, value: impl Into<Option<i64>>) -> Self {
1762 self._fields.7 = value.into();
1763 self
1764 }
1765 pub fn maybe_reply_count(mut self, value: Option<i64>) -> Self {
1767 self._fields.7 = value;
1768 self
1769 }
1770}
1771
1772impl<'a, S: view_record_state::State> ViewRecordBuilder<'a, S> {
1773 pub fn repost_count(mut self, value: impl Into<Option<i64>>) -> Self {
1775 self._fields.8 = value.into();
1776 self
1777 }
1778 pub fn maybe_repost_count(mut self, value: Option<i64>) -> Self {
1780 self._fields.8 = value;
1781 self
1782 }
1783}
1784
1785impl<'a, S> ViewRecordBuilder<'a, S>
1786where
1787 S: view_record_state::State,
1788 S::Uri: view_record_state::IsUnset,
1789{
1790 pub fn uri(
1792 mut self,
1793 value: impl Into<AtUri<'a>>,
1794 ) -> ViewRecordBuilder<'a, view_record_state::SetUri<S>> {
1795 self._fields.9 = Option::Some(value.into());
1796 ViewRecordBuilder {
1797 _state: PhantomData,
1798 _fields: self._fields,
1799 _lifetime: PhantomData,
1800 }
1801 }
1802}
1803
1804impl<'a, S> ViewRecordBuilder<'a, S>
1805where
1806 S: view_record_state::State,
1807 S::Value: view_record_state::IsUnset,
1808{
1809 pub fn value(
1811 mut self,
1812 value: impl Into<Data<'a>>,
1813 ) -> ViewRecordBuilder<'a, view_record_state::SetValue<S>> {
1814 self._fields.10 = Option::Some(value.into());
1815 ViewRecordBuilder {
1816 _state: PhantomData,
1817 _fields: self._fields,
1818 _lifetime: PhantomData,
1819 }
1820 }
1821}
1822
1823impl<'a, S> ViewRecordBuilder<'a, S>
1824where
1825 S: view_record_state::State,
1826 S::Author: view_record_state::IsSet,
1827 S::IndexedAt: view_record_state::IsSet,
1828 S::Uri: view_record_state::IsSet,
1829 S::Cid: view_record_state::IsSet,
1830 S::Value: view_record_state::IsSet,
1831{
1832 pub fn build(self) -> ViewRecord<'a> {
1834 ViewRecord {
1835 author: self._fields.0.unwrap(),
1836 cid: self._fields.1.unwrap(),
1837 embeds: self._fields.2,
1838 indexed_at: self._fields.3.unwrap(),
1839 labels: self._fields.4,
1840 like_count: self._fields.5,
1841 quote_count: self._fields.6,
1842 reply_count: self._fields.7,
1843 repost_count: self._fields.8,
1844 uri: self._fields.9.unwrap(),
1845 value: self._fields.10.unwrap(),
1846 extra_data: Default::default(),
1847 }
1848 }
1849 pub fn build_with_data(
1851 self,
1852 extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1853 ) -> ViewRecord<'a> {
1854 ViewRecord {
1855 author: self._fields.0.unwrap(),
1856 cid: self._fields.1.unwrap(),
1857 embeds: self._fields.2,
1858 indexed_at: self._fields.3.unwrap(),
1859 labels: self._fields.4,
1860 like_count: self._fields.5,
1861 quote_count: self._fields.6,
1862 reply_count: self._fields.7,
1863 repost_count: self._fields.8,
1864 uri: self._fields.9.unwrap(),
1865 value: self._fields.10.unwrap(),
1866 extra_data: Some(extra_data),
1867 }
1868 }
1869}