1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
14
15#[allow(unused_imports)]
16use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
17use jacquard_common::deps::smol_str::SmolStr;
18use jacquard_common::types::collection::{Collection, RecordError};
19use jacquard_common::types::string::{AtUri, Cid, Datetime, Language};
20use jacquard_common::types::uri::{RecordUri, UriError};
21use jacquard_common::types::value::Data;
22use jacquard_common::xrpc::XrpcResp;
23use jacquard_derive::{IntoStatic, lexicon, open_union};
24use jacquard_lexicon::lexicon::LexiconDoc;
25use jacquard_lexicon::schema::LexiconSchema;
26
27#[allow(unused_imports)]
28use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
29use serde::{Serialize, Deserialize};
30use crate::app_bsky::embed::external::ExternalRecord;
31use crate::app_bsky::embed::images::Images;
32use crate::app_bsky::embed::record::Record;
33use crate::app_bsky::embed::record_with_media::RecordWithMedia;
34use crate::app_bsky::embed::video::Video;
35use crate::app_bsky::richtext::facet::Facet;
36use crate::com_atproto::label::SelfLabels;
37use crate::com_atproto::repo::strong_ref::StrongRef;
38use crate::net_anisota::feed::draft;
39#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
42#[serde(
43 rename_all = "camelCase",
44 rename = "net.anisota.feed.draft",
45 tag = "$type",
46 bound(deserialize = "S: Deserialize<'de> + BosStr")
47)]
48pub struct Draft<S: BosStr = DefaultStr> {
49 pub created_at: Datetime,
51 #[serde(skip_serializing_if = "Option::is_none")]
52 pub embed: Option<DraftEmbed<S>>,
53 #[serde(skip_serializing_if = "Option::is_none")]
55 pub facets: Option<Vec<Facet<S>>>,
56 #[serde(skip_serializing_if = "Option::is_none")]
58 pub labels: Option<SelfLabels<S>>,
59 #[serde(skip_serializing_if = "Option::is_none")]
61 pub langs: Option<Vec<Language>>,
62 #[serde(skip_serializing_if = "Option::is_none")]
63 pub reply: Option<draft::ReplyRef<S>>,
64 #[serde(skip_serializing_if = "Option::is_none")]
66 pub tags: Option<Vec<S>>,
67 pub text: S,
69 #[serde(skip_serializing_if = "Option::is_none")]
71 pub updated_at: Option<Datetime>,
72 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
73 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
74}
75
76
77#[open_union]
78#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
79#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
80pub enum DraftEmbed<S: BosStr = DefaultStr> {
81 #[serde(rename = "app.bsky.embed.images")]
82 Images(Box<Images<S>>),
83 #[serde(rename = "app.bsky.embed.video")]
84 Video(Box<Video<S>>),
85 #[serde(rename = "app.bsky.embed.external")]
86 External(Box<ExternalRecord<S>>),
87 #[serde(rename = "app.bsky.embed.record")]
88 Record(Box<Record<S>>),
89 #[serde(rename = "app.bsky.embed.recordWithMedia")]
90 RecordWithMedia(Box<RecordWithMedia<S>>),
91}
92
93#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
96#[serde(rename_all = "camelCase")]
97pub struct DraftGetRecordOutput<S: BosStr = DefaultStr> {
98 #[serde(skip_serializing_if = "Option::is_none")]
99 pub cid: Option<Cid<S>>,
100 pub uri: AtUri<S>,
101 pub value: Draft<S>,
102}
103
104
105#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
106#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
107pub struct ReplyRef<S: BosStr = DefaultStr> {
108 pub parent: StrongRef<S>,
109 pub root: StrongRef<S>,
110 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
111 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
112}
113
114impl<S: BosStr> Draft<S> {
115 pub fn uri(uri: S) -> Result<RecordUri<S, DraftRecord>, UriError> {
116 RecordUri::try_from_uri(AtUri::new(uri)?)
117 }
118}
119
120#[derive(Debug, Serialize, Deserialize)]
123pub struct DraftRecord;
124impl XrpcResp for DraftRecord {
125 const NSID: &'static str = "net.anisota.feed.draft";
126 const ENCODING: &'static str = "application/json";
127 type Output<S: BosStr> = DraftGetRecordOutput<S>;
128 type Err = RecordError;
129}
130
131impl<S: BosStr> From<DraftGetRecordOutput<S>> for Draft<S> {
132 fn from(output: DraftGetRecordOutput<S>) -> Self {
133 output.value
134 }
135}
136
137impl<S: BosStr> Collection for Draft<S> {
138 const NSID: &'static str = "net.anisota.feed.draft";
139 type Record = DraftRecord;
140}
141
142impl Collection for DraftRecord {
143 const NSID: &'static str = "net.anisota.feed.draft";
144 type Record = DraftRecord;
145}
146
147impl<S: BosStr> LexiconSchema for Draft<S> {
148 fn nsid() -> &'static str {
149 "net.anisota.feed.draft"
150 }
151 fn def_name() -> &'static str {
152 "main"
153 }
154 fn lexicon_doc() -> LexiconDoc<'static> {
155 lexicon_doc_net_anisota_feed_draft()
156 }
157 fn validate(&self) -> Result<(), ConstraintError> {
158 if let Some(ref value) = self.langs {
159 #[allow(unused_comparisons)]
160 if value.len() > 3usize {
161 return Err(ConstraintError::MaxLength {
162 path: ValidationPath::from_field("langs"),
163 max: 3usize,
164 actual: value.len(),
165 });
166 }
167 }
168 if let Some(ref value) = self.tags {
169 #[allow(unused_comparisons)]
170 if value.len() > 8usize {
171 return Err(ConstraintError::MaxLength {
172 path: ValidationPath::from_field("tags"),
173 max: 8usize,
174 actual: value.len(),
175 });
176 }
177 }
178 {
179 let value = &self.text;
180 #[allow(unused_comparisons)]
181 if <str>::len(value.as_ref()) > 3000usize {
182 return Err(ConstraintError::MaxLength {
183 path: ValidationPath::from_field("text"),
184 max: 3000usize,
185 actual: <str>::len(value.as_ref()),
186 });
187 }
188 }
189 {
190 let value = &self.text;
191 {
192 let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
193 if count > 300usize {
194 return Err(ConstraintError::MaxGraphemes {
195 path: ValidationPath::from_field("text"),
196 max: 300usize,
197 actual: count,
198 });
199 }
200 }
201 }
202 Ok(())
203 }
204}
205
206impl<S: BosStr> LexiconSchema for ReplyRef<S> {
207 fn nsid() -> &'static str {
208 "net.anisota.feed.draft"
209 }
210 fn def_name() -> &'static str {
211 "replyRef"
212 }
213 fn lexicon_doc() -> LexiconDoc<'static> {
214 lexicon_doc_net_anisota_feed_draft()
215 }
216 fn validate(&self) -> Result<(), ConstraintError> {
217 Ok(())
218 }
219}
220
221pub mod draft_state {
222
223 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
224 #[allow(unused)]
225 use ::core::marker::PhantomData;
226 mod sealed {
227 pub trait Sealed {}
228 }
229 pub trait State: sealed::Sealed {
231 type CreatedAt;
232 type Text;
233 }
234 pub struct Empty(());
236 impl sealed::Sealed for Empty {}
237 impl State for Empty {
238 type CreatedAt = Unset;
239 type Text = Unset;
240 }
241 pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
243 impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
244 impl<St: State> State for SetCreatedAt<St> {
245 type CreatedAt = Set<members::created_at>;
246 type Text = St::Text;
247 }
248 pub struct SetText<St: State = Empty>(PhantomData<fn() -> St>);
250 impl<St: State> sealed::Sealed for SetText<St> {}
251 impl<St: State> State for SetText<St> {
252 type CreatedAt = St::CreatedAt;
253 type Text = Set<members::text>;
254 }
255 #[allow(non_camel_case_types)]
257 pub mod members {
258 pub struct created_at(());
260 pub struct text(());
262 }
263}
264
265pub struct DraftBuilder<St: draft_state::State, S: BosStr = DefaultStr> {
267 _state: PhantomData<fn() -> St>,
268 _fields: (
269 Option<Datetime>,
270 Option<DraftEmbed<S>>,
271 Option<Vec<Facet<S>>>,
272 Option<SelfLabels<S>>,
273 Option<Vec<Language>>,
274 Option<draft::ReplyRef<S>>,
275 Option<Vec<S>>,
276 Option<S>,
277 Option<Datetime>,
278 ),
279 _type: PhantomData<fn() -> S>,
280}
281
282impl Draft<DefaultStr> {
283 pub fn new() -> DraftBuilder<draft_state::Empty, DefaultStr> {
285 DraftBuilder::new()
286 }
287}
288
289impl<S: BosStr> Draft<S> {
290 pub fn builder() -> DraftBuilder<draft_state::Empty, S> {
292 DraftBuilder::builder()
293 }
294}
295
296impl DraftBuilder<draft_state::Empty, DefaultStr> {
297 pub fn new() -> Self {
299 DraftBuilder {
300 _state: PhantomData,
301 _fields: (None, None, None, None, None, None, None, None, None),
302 _type: PhantomData,
303 }
304 }
305}
306
307impl<S: BosStr> DraftBuilder<draft_state::Empty, S> {
308 pub fn builder() -> Self {
310 DraftBuilder {
311 _state: PhantomData,
312 _fields: (None, None, None, None, None, None, None, None, None),
313 _type: PhantomData,
314 }
315 }
316}
317
318impl<St, S: BosStr> DraftBuilder<St, S>
319where
320 St: draft_state::State,
321 St::CreatedAt: draft_state::IsUnset,
322{
323 pub fn created_at(
325 mut self,
326 value: impl Into<Datetime>,
327 ) -> DraftBuilder<draft_state::SetCreatedAt<St>, S> {
328 self._fields.0 = Option::Some(value.into());
329 DraftBuilder {
330 _state: PhantomData,
331 _fields: self._fields,
332 _type: PhantomData,
333 }
334 }
335}
336
337impl<St: draft_state::State, S: BosStr> DraftBuilder<St, S> {
338 pub fn embed(mut self, value: impl Into<Option<DraftEmbed<S>>>) -> Self {
340 self._fields.1 = value.into();
341 self
342 }
343 pub fn maybe_embed(mut self, value: Option<DraftEmbed<S>>) -> Self {
345 self._fields.1 = value;
346 self
347 }
348}
349
350impl<St: draft_state::State, S: BosStr> DraftBuilder<St, S> {
351 pub fn facets(mut self, value: impl Into<Option<Vec<Facet<S>>>>) -> Self {
353 self._fields.2 = value.into();
354 self
355 }
356 pub fn maybe_facets(mut self, value: Option<Vec<Facet<S>>>) -> Self {
358 self._fields.2 = value;
359 self
360 }
361}
362
363impl<St: draft_state::State, S: BosStr> DraftBuilder<St, S> {
364 pub fn labels(mut self, value: impl Into<Option<SelfLabels<S>>>) -> Self {
366 self._fields.3 = value.into();
367 self
368 }
369 pub fn maybe_labels(mut self, value: Option<SelfLabels<S>>) -> Self {
371 self._fields.3 = value;
372 self
373 }
374}
375
376impl<St: draft_state::State, S: BosStr> DraftBuilder<St, S> {
377 pub fn langs(mut self, value: impl Into<Option<Vec<Language>>>) -> Self {
379 self._fields.4 = value.into();
380 self
381 }
382 pub fn maybe_langs(mut self, value: Option<Vec<Language>>) -> Self {
384 self._fields.4 = value;
385 self
386 }
387}
388
389impl<St: draft_state::State, S: BosStr> DraftBuilder<St, S> {
390 pub fn reply(mut self, value: impl Into<Option<draft::ReplyRef<S>>>) -> Self {
392 self._fields.5 = value.into();
393 self
394 }
395 pub fn maybe_reply(mut self, value: Option<draft::ReplyRef<S>>) -> Self {
397 self._fields.5 = value;
398 self
399 }
400}
401
402impl<St: draft_state::State, S: BosStr> DraftBuilder<St, S> {
403 pub fn tags(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
405 self._fields.6 = value.into();
406 self
407 }
408 pub fn maybe_tags(mut self, value: Option<Vec<S>>) -> Self {
410 self._fields.6 = value;
411 self
412 }
413}
414
415impl<St, S: BosStr> DraftBuilder<St, S>
416where
417 St: draft_state::State,
418 St::Text: draft_state::IsUnset,
419{
420 pub fn text(
422 mut self,
423 value: impl Into<S>,
424 ) -> DraftBuilder<draft_state::SetText<St>, S> {
425 self._fields.7 = Option::Some(value.into());
426 DraftBuilder {
427 _state: PhantomData,
428 _fields: self._fields,
429 _type: PhantomData,
430 }
431 }
432}
433
434impl<St: draft_state::State, S: BosStr> DraftBuilder<St, S> {
435 pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
437 self._fields.8 = value.into();
438 self
439 }
440 pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
442 self._fields.8 = value;
443 self
444 }
445}
446
447impl<St, S: BosStr> DraftBuilder<St, S>
448where
449 St: draft_state::State,
450 St::CreatedAt: draft_state::IsSet,
451 St::Text: draft_state::IsSet,
452{
453 pub fn build(self) -> Draft<S> {
455 Draft {
456 created_at: self._fields.0.unwrap(),
457 embed: self._fields.1,
458 facets: self._fields.2,
459 labels: self._fields.3,
460 langs: self._fields.4,
461 reply: self._fields.5,
462 tags: self._fields.6,
463 text: self._fields.7.unwrap(),
464 updated_at: self._fields.8,
465 extra_data: Default::default(),
466 }
467 }
468 pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Draft<S> {
470 Draft {
471 created_at: self._fields.0.unwrap(),
472 embed: self._fields.1,
473 facets: self._fields.2,
474 labels: self._fields.3,
475 langs: self._fields.4,
476 reply: self._fields.5,
477 tags: self._fields.6,
478 text: self._fields.7.unwrap(),
479 updated_at: self._fields.8,
480 extra_data: Some(extra_data),
481 }
482 }
483}
484
485fn lexicon_doc_net_anisota_feed_draft() -> LexiconDoc<'static> {
486 #[allow(unused_imports)]
487 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
488 use jacquard_lexicon::lexicon::*;
489 use alloc::collections::BTreeMap;
490 LexiconDoc {
491 lexicon: Lexicon::Lexicon1,
492 id: CowStr::new_static("net.anisota.feed.draft"),
493 defs: {
494 let mut map = BTreeMap::new();
495 map.insert(
496 SmolStr::new_static("main"),
497 LexUserType::Record(LexRecord {
498 description: Some(
499 CowStr::new_static(
500 "Record containing a draft post that can be edited and later published as app.bsky.feed.post",
501 ),
502 ),
503 key: Some(CowStr::new_static("tid")),
504 record: LexRecordRecord::Object(LexObject {
505 required: Some(
506 vec![
507 SmolStr::new_static("text"),
508 SmolStr::new_static("createdAt")
509 ],
510 ),
511 properties: {
512 #[allow(unused_mut)]
513 let mut map = BTreeMap::new();
514 map.insert(
515 SmolStr::new_static("createdAt"),
516 LexObjectProperty::String(LexString {
517 description: Some(
518 CowStr::new_static(
519 "Client-declared timestamp when this draft was originally created.",
520 ),
521 ),
522 format: Some(LexStringFormat::Datetime),
523 ..Default::default()
524 }),
525 );
526 map.insert(
527 SmolStr::new_static("embed"),
528 LexObjectProperty::Union(LexRefUnion {
529 refs: vec![
530 CowStr::new_static("app.bsky.embed.images"),
531 CowStr::new_static("app.bsky.embed.video"),
532 CowStr::new_static("app.bsky.embed.external"),
533 CowStr::new_static("app.bsky.embed.record"),
534 CowStr::new_static("app.bsky.embed.recordWithMedia")
535 ],
536 ..Default::default()
537 }),
538 );
539 map.insert(
540 SmolStr::new_static("facets"),
541 LexObjectProperty::Array(LexArray {
542 description: Some(
543 CowStr::new_static(
544 "Annotations of text (mentions, URLs, hashtags, etc)",
545 ),
546 ),
547 items: LexArrayItem::Ref(LexRef {
548 r#ref: CowStr::new_static("app.bsky.richtext.facet"),
549 ..Default::default()
550 }),
551 ..Default::default()
552 }),
553 );
554 map.insert(
555 SmolStr::new_static("labels"),
556 LexObjectProperty::Union(LexRefUnion {
557 description: Some(
558 CowStr::new_static(
559 "Self-label values for this post. Effectively content warnings.",
560 ),
561 ),
562 refs: vec![
563 CowStr::new_static("com.atproto.label.defs#selfLabels")
564 ],
565 ..Default::default()
566 }),
567 );
568 map.insert(
569 SmolStr::new_static("langs"),
570 LexObjectProperty::Array(LexArray {
571 description: Some(
572 CowStr::new_static(
573 "Indicates human language of post primary text content.",
574 ),
575 ),
576 items: LexArrayItem::String(LexString {
577 format: Some(LexStringFormat::Language),
578 ..Default::default()
579 }),
580 max_length: Some(3usize),
581 ..Default::default()
582 }),
583 );
584 map.insert(
585 SmolStr::new_static("reply"),
586 LexObjectProperty::Ref(LexRef {
587 r#ref: CowStr::new_static("#replyRef"),
588 ..Default::default()
589 }),
590 );
591 map.insert(
592 SmolStr::new_static("tags"),
593 LexObjectProperty::Array(LexArray {
594 description: Some(
595 CowStr::new_static(
596 "Additional hashtags, in addition to any included in post text and facets.",
597 ),
598 ),
599 items: LexArrayItem::String(LexString {
600 max_length: Some(640usize),
601 max_graphemes: Some(64usize),
602 ..Default::default()
603 }),
604 max_length: Some(8usize),
605 ..Default::default()
606 }),
607 );
608 map.insert(
609 SmolStr::new_static("text"),
610 LexObjectProperty::String(LexString {
611 description: Some(
612 CowStr::new_static(
613 "The primary post content. May be an empty string, if there are embeds.",
614 ),
615 ),
616 max_length: Some(3000usize),
617 max_graphemes: Some(300usize),
618 ..Default::default()
619 }),
620 );
621 map.insert(
622 SmolStr::new_static("updatedAt"),
623 LexObjectProperty::String(LexString {
624 description: Some(
625 CowStr::new_static(
626 "Client-declared timestamp when this draft was last updated.",
627 ),
628 ),
629 format: Some(LexStringFormat::Datetime),
630 ..Default::default()
631 }),
632 );
633 map
634 },
635 ..Default::default()
636 }),
637 ..Default::default()
638 }),
639 );
640 map.insert(
641 SmolStr::new_static("replyRef"),
642 LexUserType::Object(LexObject {
643 required: Some(
644 vec![SmolStr::new_static("root"), SmolStr::new_static("parent")],
645 ),
646 properties: {
647 #[allow(unused_mut)]
648 let mut map = BTreeMap::new();
649 map.insert(
650 SmolStr::new_static("parent"),
651 LexObjectProperty::Ref(LexRef {
652 r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
653 ..Default::default()
654 }),
655 );
656 map.insert(
657 SmolStr::new_static("root"),
658 LexObjectProperty::Ref(LexRef {
659 r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
660 ..Default::default()
661 }),
662 );
663 map
664 },
665 ..Default::default()
666 }),
667 );
668 map
669 },
670 ..Default::default()
671 }
672}
673
674pub mod reply_ref_state {
675
676 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
677 #[allow(unused)]
678 use ::core::marker::PhantomData;
679 mod sealed {
680 pub trait Sealed {}
681 }
682 pub trait State: sealed::Sealed {
684 type Parent;
685 type Root;
686 }
687 pub struct Empty(());
689 impl sealed::Sealed for Empty {}
690 impl State for Empty {
691 type Parent = Unset;
692 type Root = Unset;
693 }
694 pub struct SetParent<St: State = Empty>(PhantomData<fn() -> St>);
696 impl<St: State> sealed::Sealed for SetParent<St> {}
697 impl<St: State> State for SetParent<St> {
698 type Parent = Set<members::parent>;
699 type Root = St::Root;
700 }
701 pub struct SetRoot<St: State = Empty>(PhantomData<fn() -> St>);
703 impl<St: State> sealed::Sealed for SetRoot<St> {}
704 impl<St: State> State for SetRoot<St> {
705 type Parent = St::Parent;
706 type Root = Set<members::root>;
707 }
708 #[allow(non_camel_case_types)]
710 pub mod members {
711 pub struct parent(());
713 pub struct root(());
715 }
716}
717
718pub struct ReplyRefBuilder<St: reply_ref_state::State, S: BosStr = DefaultStr> {
720 _state: PhantomData<fn() -> St>,
721 _fields: (Option<StrongRef<S>>, Option<StrongRef<S>>),
722 _type: PhantomData<fn() -> S>,
723}
724
725impl ReplyRef<DefaultStr> {
726 pub fn new() -> ReplyRefBuilder<reply_ref_state::Empty, DefaultStr> {
728 ReplyRefBuilder::new()
729 }
730}
731
732impl<S: BosStr> ReplyRef<S> {
733 pub fn builder() -> ReplyRefBuilder<reply_ref_state::Empty, S> {
735 ReplyRefBuilder::builder()
736 }
737}
738
739impl ReplyRefBuilder<reply_ref_state::Empty, DefaultStr> {
740 pub fn new() -> Self {
742 ReplyRefBuilder {
743 _state: PhantomData,
744 _fields: (None, None),
745 _type: PhantomData,
746 }
747 }
748}
749
750impl<S: BosStr> ReplyRefBuilder<reply_ref_state::Empty, S> {
751 pub fn builder() -> Self {
753 ReplyRefBuilder {
754 _state: PhantomData,
755 _fields: (None, None),
756 _type: PhantomData,
757 }
758 }
759}
760
761impl<St, S: BosStr> ReplyRefBuilder<St, S>
762where
763 St: reply_ref_state::State,
764 St::Parent: reply_ref_state::IsUnset,
765{
766 pub fn parent(
768 mut self,
769 value: impl Into<StrongRef<S>>,
770 ) -> ReplyRefBuilder<reply_ref_state::SetParent<St>, S> {
771 self._fields.0 = Option::Some(value.into());
772 ReplyRefBuilder {
773 _state: PhantomData,
774 _fields: self._fields,
775 _type: PhantomData,
776 }
777 }
778}
779
780impl<St, S: BosStr> ReplyRefBuilder<St, S>
781where
782 St: reply_ref_state::State,
783 St::Root: reply_ref_state::IsUnset,
784{
785 pub fn root(
787 mut self,
788 value: impl Into<StrongRef<S>>,
789 ) -> ReplyRefBuilder<reply_ref_state::SetRoot<St>, S> {
790 self._fields.1 = Option::Some(value.into());
791 ReplyRefBuilder {
792 _state: PhantomData,
793 _fields: self._fields,
794 _type: PhantomData,
795 }
796 }
797}
798
799impl<St, S: BosStr> ReplyRefBuilder<St, S>
800where
801 St: reply_ref_state::State,
802 St::Parent: reply_ref_state::IsSet,
803 St::Root: reply_ref_state::IsSet,
804{
805 pub fn build(self) -> ReplyRef<S> {
807 ReplyRef {
808 parent: self._fields.0.unwrap(),
809 root: self._fields.1.unwrap(),
810 extra_data: Default::default(),
811 }
812 }
813 pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> ReplyRef<S> {
815 ReplyRef {
816 parent: self._fields.0.unwrap(),
817 root: self._fields.1.unwrap(),
818 extra_data: Some(extra_data),
819 }
820 }
821}