1#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct External<'a> {
20 #[serde(borrow)]
21 pub description: jacquard_common::CowStr<'a>,
22 #[serde(skip_serializing_if = "std::option::Option::is_none")]
23 #[serde(borrow)]
24 pub thumb: Option<jacquard_common::types::blob::BlobRef<'a>>,
25 #[serde(borrow)]
26 pub title: jacquard_common::CowStr<'a>,
27 #[serde(borrow)]
28 pub uri: jacquard_common::types::string::Uri<'a>,
29}
30
31pub mod external_state {
32
33 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
34 #[allow(unused)]
35 use ::core::marker::PhantomData;
36 mod sealed {
37 pub trait Sealed {}
38 }
39 pub trait State: sealed::Sealed {
41 type Uri;
42 type Title;
43 type Description;
44 }
45 pub struct Empty(());
47 impl sealed::Sealed for Empty {}
48 impl State for Empty {
49 type Uri = Unset;
50 type Title = Unset;
51 type Description = Unset;
52 }
53 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
55 impl<S: State> sealed::Sealed for SetUri<S> {}
56 impl<S: State> State for SetUri<S> {
57 type Uri = Set<members::uri>;
58 type Title = S::Title;
59 type Description = S::Description;
60 }
61 pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
63 impl<S: State> sealed::Sealed for SetTitle<S> {}
64 impl<S: State> State for SetTitle<S> {
65 type Uri = S::Uri;
66 type Title = Set<members::title>;
67 type Description = S::Description;
68 }
69 pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>);
71 impl<S: State> sealed::Sealed for SetDescription<S> {}
72 impl<S: State> State for SetDescription<S> {
73 type Uri = S::Uri;
74 type Title = S::Title;
75 type Description = Set<members::description>;
76 }
77 #[allow(non_camel_case_types)]
79 pub mod members {
80 pub struct uri(());
82 pub struct title(());
84 pub struct description(());
86 }
87}
88
89pub struct ExternalBuilder<'a, S: external_state::State> {
91 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
92 __unsafe_private_named: (
93 ::core::option::Option<jacquard_common::CowStr<'a>>,
94 ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>,
95 ::core::option::Option<jacquard_common::CowStr<'a>>,
96 ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
97 ),
98 _phantom: ::core::marker::PhantomData<&'a ()>,
99}
100
101impl<'a> External<'a> {
102 pub fn new() -> ExternalBuilder<'a, external_state::Empty> {
104 ExternalBuilder::new()
105 }
106}
107
108impl<'a> ExternalBuilder<'a, external_state::Empty> {
109 pub fn new() -> Self {
111 ExternalBuilder {
112 _phantom_state: ::core::marker::PhantomData,
113 __unsafe_private_named: (None, None, None, None),
114 _phantom: ::core::marker::PhantomData,
115 }
116 }
117}
118
119impl<'a, S> ExternalBuilder<'a, S>
120where
121 S: external_state::State,
122 S::Description: external_state::IsUnset,
123{
124 pub fn description(
126 mut self,
127 value: impl Into<jacquard_common::CowStr<'a>>,
128 ) -> ExternalBuilder<'a, external_state::SetDescription<S>> {
129 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
130 ExternalBuilder {
131 _phantom_state: ::core::marker::PhantomData,
132 __unsafe_private_named: self.__unsafe_private_named,
133 _phantom: ::core::marker::PhantomData,
134 }
135 }
136}
137
138impl<'a, S: external_state::State> ExternalBuilder<'a, S> {
139 pub fn thumb(
141 mut self,
142 value: impl Into<Option<jacquard_common::types::blob::BlobRef<'a>>>,
143 ) -> Self {
144 self.__unsafe_private_named.1 = value.into();
145 self
146 }
147 pub fn maybe_thumb(
149 mut self,
150 value: Option<jacquard_common::types::blob::BlobRef<'a>>,
151 ) -> Self {
152 self.__unsafe_private_named.1 = value;
153 self
154 }
155}
156
157impl<'a, S> ExternalBuilder<'a, S>
158where
159 S: external_state::State,
160 S::Title: external_state::IsUnset,
161{
162 pub fn title(
164 mut self,
165 value: impl Into<jacquard_common::CowStr<'a>>,
166 ) -> ExternalBuilder<'a, external_state::SetTitle<S>> {
167 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
168 ExternalBuilder {
169 _phantom_state: ::core::marker::PhantomData,
170 __unsafe_private_named: self.__unsafe_private_named,
171 _phantom: ::core::marker::PhantomData,
172 }
173 }
174}
175
176impl<'a, S> ExternalBuilder<'a, S>
177where
178 S: external_state::State,
179 S::Uri: external_state::IsUnset,
180{
181 pub fn uri(
183 mut self,
184 value: impl Into<jacquard_common::types::string::Uri<'a>>,
185 ) -> ExternalBuilder<'a, external_state::SetUri<S>> {
186 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
187 ExternalBuilder {
188 _phantom_state: ::core::marker::PhantomData,
189 __unsafe_private_named: self.__unsafe_private_named,
190 _phantom: ::core::marker::PhantomData,
191 }
192 }
193}
194
195impl<'a, S> ExternalBuilder<'a, S>
196where
197 S: external_state::State,
198 S::Uri: external_state::IsSet,
199 S::Title: external_state::IsSet,
200 S::Description: external_state::IsSet,
201{
202 pub fn build(self) -> External<'a> {
204 External {
205 description: self.__unsafe_private_named.0.unwrap(),
206 thumb: self.__unsafe_private_named.1,
207 title: self.__unsafe_private_named.2.unwrap(),
208 uri: self.__unsafe_private_named.3.unwrap(),
209 extra_data: Default::default(),
210 }
211 }
212 pub fn build_with_data(
214 self,
215 extra_data: std::collections::BTreeMap<
216 jacquard_common::smol_str::SmolStr,
217 jacquard_common::types::value::Data<'a>,
218 >,
219 ) -> External<'a> {
220 External {
221 description: self.__unsafe_private_named.0.unwrap(),
222 thumb: self.__unsafe_private_named.1,
223 title: self.__unsafe_private_named.2.unwrap(),
224 uri: self.__unsafe_private_named.3.unwrap(),
225 extra_data: Some(extra_data),
226 }
227 }
228}
229
230fn lexicon_doc_sh_weaver_embed_external() -> ::jacquard_lexicon::lexicon::LexiconDoc<
231 'static,
232> {
233 ::jacquard_lexicon::lexicon::LexiconDoc {
234 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
235 id: ::jacquard_common::CowStr::new_static("sh.weaver.embed.external"),
236 revision: None,
237 description: None,
238 defs: {
239 let mut map = ::std::collections::BTreeMap::new();
240 map.insert(
241 ::jacquard_common::smol_str::SmolStr::new_static("external"),
242 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
243 description: None,
244 required: Some(
245 vec![
246 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
247 ::jacquard_common::smol_str::SmolStr::new_static("title"),
248 ::jacquard_common::smol_str::SmolStr::new_static("description")
249 ],
250 ),
251 nullable: None,
252 properties: {
253 #[allow(unused_mut)]
254 let mut map = ::std::collections::BTreeMap::new();
255 map.insert(
256 ::jacquard_common::smol_str::SmolStr::new_static(
257 "description",
258 ),
259 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
260 description: None,
261 format: None,
262 default: None,
263 min_length: None,
264 max_length: None,
265 min_graphemes: None,
266 max_graphemes: None,
267 r#enum: None,
268 r#const: None,
269 known_values: None,
270 }),
271 );
272 map.insert(
273 ::jacquard_common::smol_str::SmolStr::new_static("thumb"),
274 ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob {
275 description: None,
276 accept: None,
277 max_size: None,
278 }),
279 );
280 map.insert(
281 ::jacquard_common::smol_str::SmolStr::new_static("title"),
282 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
283 description: None,
284 format: None,
285 default: None,
286 min_length: None,
287 max_length: None,
288 min_graphemes: None,
289 max_graphemes: None,
290 r#enum: None,
291 r#const: None,
292 known_values: None,
293 }),
294 );
295 map.insert(
296 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
297 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
298 description: None,
299 format: Some(
300 ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
301 ),
302 default: None,
303 min_length: None,
304 max_length: None,
305 min_graphemes: None,
306 max_graphemes: None,
307 r#enum: None,
308 r#const: None,
309 known_values: None,
310 }),
311 );
312 map
313 },
314 }),
315 );
316 map.insert(
317 ::jacquard_common::smol_str::SmolStr::new_static("main"),
318 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
319 description: None,
320 required: Some(
321 vec![::jacquard_common::smol_str::SmolStr::new_static("embeds")],
322 ),
323 nullable: None,
324 properties: {
325 #[allow(unused_mut)]
326 let mut map = ::std::collections::BTreeMap::new();
327 map.insert(
328 ::jacquard_common::smol_str::SmolStr::new_static("embeds"),
329 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
330 description: None,
331 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
332 description: None,
333 r#ref: ::jacquard_common::CowStr::new_static("#external"),
334 }),
335 min_length: None,
336 max_length: Some(48usize),
337 }),
338 );
339 map
340 },
341 }),
342 );
343 map.insert(
344 ::jacquard_common::smol_str::SmolStr::new_static("view"),
345 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
346 description: None,
347 required: Some(
348 vec![
349 ::jacquard_common::smol_str::SmolStr::new_static("external")
350 ],
351 ),
352 nullable: None,
353 properties: {
354 #[allow(unused_mut)]
355 let mut map = ::std::collections::BTreeMap::new();
356 map.insert(
357 ::jacquard_common::smol_str::SmolStr::new_static("external"),
358 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
359 description: None,
360 r#ref: ::jacquard_common::CowStr::new_static(
361 "#viewExternal",
362 ),
363 }),
364 );
365 map
366 },
367 }),
368 );
369 map.insert(
370 ::jacquard_common::smol_str::SmolStr::new_static("viewExternal"),
371 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
372 description: None,
373 required: Some(
374 vec![
375 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
376 ::jacquard_common::smol_str::SmolStr::new_static("title"),
377 ::jacquard_common::smol_str::SmolStr::new_static("description")
378 ],
379 ),
380 nullable: None,
381 properties: {
382 #[allow(unused_mut)]
383 let mut map = ::std::collections::BTreeMap::new();
384 map.insert(
385 ::jacquard_common::smol_str::SmolStr::new_static(
386 "description",
387 ),
388 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
389 description: None,
390 format: None,
391 default: None,
392 min_length: None,
393 max_length: None,
394 min_graphemes: None,
395 max_graphemes: None,
396 r#enum: None,
397 r#const: None,
398 known_values: None,
399 }),
400 );
401 map.insert(
402 ::jacquard_common::smol_str::SmolStr::new_static("thumb"),
403 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
404 description: None,
405 format: Some(
406 ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
407 ),
408 default: None,
409 min_length: None,
410 max_length: None,
411 min_graphemes: None,
412 max_graphemes: None,
413 r#enum: None,
414 r#const: None,
415 known_values: None,
416 }),
417 );
418 map.insert(
419 ::jacquard_common::smol_str::SmolStr::new_static("title"),
420 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
421 description: None,
422 format: None,
423 default: None,
424 min_length: None,
425 max_length: None,
426 min_graphemes: None,
427 max_graphemes: None,
428 r#enum: None,
429 r#const: None,
430 known_values: None,
431 }),
432 );
433 map.insert(
434 ::jacquard_common::smol_str::SmolStr::new_static("uri"),
435 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
436 description: None,
437 format: Some(
438 ::jacquard_lexicon::lexicon::LexStringFormat::Uri,
439 ),
440 default: None,
441 min_length: None,
442 max_length: None,
443 min_graphemes: None,
444 max_graphemes: None,
445 r#enum: None,
446 r#const: None,
447 known_values: None,
448 }),
449 );
450 map
451 },
452 }),
453 );
454 map
455 },
456 }
457}
458
459impl<'a> ::jacquard_lexicon::schema::LexiconSchema for External<'a> {
460 fn nsid() -> &'static str {
461 "sh.weaver.embed.external"
462 }
463 fn def_name() -> &'static str {
464 "external"
465 }
466 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
467 lexicon_doc_sh_weaver_embed_external()
468 }
469 fn validate(
470 &self,
471 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
472 Ok(())
473 }
474}
475
476#[jacquard_derive::lexicon]
477#[derive(
478 serde::Serialize,
479 serde::Deserialize,
480 Debug,
481 Clone,
482 PartialEq,
483 Eq,
484 jacquard_derive::IntoStatic
485)]
486#[serde(rename_all = "camelCase")]
487pub struct ExternalRecord<'a> {
488 #[serde(borrow)]
489 pub embeds: Vec<crate::sh_weaver::embed::external::External<'a>>,
490}
491
492pub mod external_record_state {
493
494 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
495 #[allow(unused)]
496 use ::core::marker::PhantomData;
497 mod sealed {
498 pub trait Sealed {}
499 }
500 pub trait State: sealed::Sealed {
502 type Embeds;
503 }
504 pub struct Empty(());
506 impl sealed::Sealed for Empty {}
507 impl State for Empty {
508 type Embeds = Unset;
509 }
510 pub struct SetEmbeds<S: State = Empty>(PhantomData<fn() -> S>);
512 impl<S: State> sealed::Sealed for SetEmbeds<S> {}
513 impl<S: State> State for SetEmbeds<S> {
514 type Embeds = Set<members::embeds>;
515 }
516 #[allow(non_camel_case_types)]
518 pub mod members {
519 pub struct embeds(());
521 }
522}
523
524pub struct ExternalRecordBuilder<'a, S: external_record_state::State> {
526 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
527 __unsafe_private_named: (
528 ::core::option::Option<Vec<crate::sh_weaver::embed::external::External<'a>>>,
529 ),
530 _phantom: ::core::marker::PhantomData<&'a ()>,
531}
532
533impl<'a> ExternalRecord<'a> {
534 pub fn new() -> ExternalRecordBuilder<'a, external_record_state::Empty> {
536 ExternalRecordBuilder::new()
537 }
538}
539
540impl<'a> ExternalRecordBuilder<'a, external_record_state::Empty> {
541 pub fn new() -> Self {
543 ExternalRecordBuilder {
544 _phantom_state: ::core::marker::PhantomData,
545 __unsafe_private_named: (None,),
546 _phantom: ::core::marker::PhantomData,
547 }
548 }
549}
550
551impl<'a, S> ExternalRecordBuilder<'a, S>
552where
553 S: external_record_state::State,
554 S::Embeds: external_record_state::IsUnset,
555{
556 pub fn embeds(
558 mut self,
559 value: impl Into<Vec<crate::sh_weaver::embed::external::External<'a>>>,
560 ) -> ExternalRecordBuilder<'a, external_record_state::SetEmbeds<S>> {
561 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
562 ExternalRecordBuilder {
563 _phantom_state: ::core::marker::PhantomData,
564 __unsafe_private_named: self.__unsafe_private_named,
565 _phantom: ::core::marker::PhantomData,
566 }
567 }
568}
569
570impl<'a, S> ExternalRecordBuilder<'a, S>
571where
572 S: external_record_state::State,
573 S::Embeds: external_record_state::IsSet,
574{
575 pub fn build(self) -> ExternalRecord<'a> {
577 ExternalRecord {
578 embeds: self.__unsafe_private_named.0.unwrap(),
579 extra_data: Default::default(),
580 }
581 }
582 pub fn build_with_data(
584 self,
585 extra_data: std::collections::BTreeMap<
586 jacquard_common::smol_str::SmolStr,
587 jacquard_common::types::value::Data<'a>,
588 >,
589 ) -> ExternalRecord<'a> {
590 ExternalRecord {
591 embeds: self.__unsafe_private_named.0.unwrap(),
592 extra_data: Some(extra_data),
593 }
594 }
595}
596
597impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ExternalRecord<'a> {
598 fn nsid() -> &'static str {
599 "sh.weaver.embed.external"
600 }
601 fn def_name() -> &'static str {
602 "main"
603 }
604 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
605 lexicon_doc_sh_weaver_embed_external()
606 }
607 fn validate(
608 &self,
609 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
610 {
611 let value = &self.embeds;
612 #[allow(unused_comparisons)]
613 if value.len() > 48usize {
614 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
615 path: ::jacquard_lexicon::validation::ValidationPath::from_field(
616 "embeds",
617 ),
618 max: 48usize,
619 actual: value.len(),
620 });
621 }
622 }
623 Ok(())
624 }
625}
626
627#[jacquard_derive::lexicon]
628#[derive(
629 serde::Serialize,
630 serde::Deserialize,
631 Debug,
632 Clone,
633 PartialEq,
634 Eq,
635 jacquard_derive::IntoStatic
636)]
637#[serde(rename_all = "camelCase")]
638pub struct View<'a> {
639 #[serde(borrow)]
640 pub external: crate::sh_weaver::embed::external::ViewExternal<'a>,
641}
642
643pub mod view_state {
644
645 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
646 #[allow(unused)]
647 use ::core::marker::PhantomData;
648 mod sealed {
649 pub trait Sealed {}
650 }
651 pub trait State: sealed::Sealed {
653 type External;
654 }
655 pub struct Empty(());
657 impl sealed::Sealed for Empty {}
658 impl State for Empty {
659 type External = Unset;
660 }
661 pub struct SetExternal<S: State = Empty>(PhantomData<fn() -> S>);
663 impl<S: State> sealed::Sealed for SetExternal<S> {}
664 impl<S: State> State for SetExternal<S> {
665 type External = Set<members::external>;
666 }
667 #[allow(non_camel_case_types)]
669 pub mod members {
670 pub struct external(());
672 }
673}
674
675pub struct ViewBuilder<'a, S: view_state::State> {
677 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
678 __unsafe_private_named: (
679 ::core::option::Option<crate::sh_weaver::embed::external::ViewExternal<'a>>,
680 ),
681 _phantom: ::core::marker::PhantomData<&'a ()>,
682}
683
684impl<'a> View<'a> {
685 pub fn new() -> ViewBuilder<'a, view_state::Empty> {
687 ViewBuilder::new()
688 }
689}
690
691impl<'a> ViewBuilder<'a, view_state::Empty> {
692 pub fn new() -> Self {
694 ViewBuilder {
695 _phantom_state: ::core::marker::PhantomData,
696 __unsafe_private_named: (None,),
697 _phantom: ::core::marker::PhantomData,
698 }
699 }
700}
701
702impl<'a, S> ViewBuilder<'a, S>
703where
704 S: view_state::State,
705 S::External: view_state::IsUnset,
706{
707 pub fn external(
709 mut self,
710 value: impl Into<crate::sh_weaver::embed::external::ViewExternal<'a>>,
711 ) -> ViewBuilder<'a, view_state::SetExternal<S>> {
712 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
713 ViewBuilder {
714 _phantom_state: ::core::marker::PhantomData,
715 __unsafe_private_named: self.__unsafe_private_named,
716 _phantom: ::core::marker::PhantomData,
717 }
718 }
719}
720
721impl<'a, S> ViewBuilder<'a, S>
722where
723 S: view_state::State,
724 S::External: view_state::IsSet,
725{
726 pub fn build(self) -> View<'a> {
728 View {
729 external: self.__unsafe_private_named.0.unwrap(),
730 extra_data: Default::default(),
731 }
732 }
733 pub fn build_with_data(
735 self,
736 extra_data: std::collections::BTreeMap<
737 jacquard_common::smol_str::SmolStr,
738 jacquard_common::types::value::Data<'a>,
739 >,
740 ) -> View<'a> {
741 View {
742 external: self.__unsafe_private_named.0.unwrap(),
743 extra_data: Some(extra_data),
744 }
745 }
746}
747
748impl<'a> ::jacquard_lexicon::schema::LexiconSchema for View<'a> {
749 fn nsid() -> &'static str {
750 "sh.weaver.embed.external"
751 }
752 fn def_name() -> &'static str {
753 "view"
754 }
755 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
756 lexicon_doc_sh_weaver_embed_external()
757 }
758 fn validate(
759 &self,
760 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
761 Ok(())
762 }
763}
764
765#[jacquard_derive::lexicon]
766#[derive(
767 serde::Serialize,
768 serde::Deserialize,
769 Debug,
770 Clone,
771 PartialEq,
772 Eq,
773 jacquard_derive::IntoStatic
774)]
775#[serde(rename_all = "camelCase")]
776pub struct ViewExternal<'a> {
777 #[serde(borrow)]
778 pub description: jacquard_common::CowStr<'a>,
779 #[serde(skip_serializing_if = "std::option::Option::is_none")]
780 #[serde(borrow)]
781 pub thumb: Option<jacquard_common::types::string::Uri<'a>>,
782 #[serde(borrow)]
783 pub title: jacquard_common::CowStr<'a>,
784 #[serde(borrow)]
785 pub uri: jacquard_common::types::string::Uri<'a>,
786}
787
788pub mod view_external_state {
789
790 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
791 #[allow(unused)]
792 use ::core::marker::PhantomData;
793 mod sealed {
794 pub trait Sealed {}
795 }
796 pub trait State: sealed::Sealed {
798 type Uri;
799 type Title;
800 type Description;
801 }
802 pub struct Empty(());
804 impl sealed::Sealed for Empty {}
805 impl State for Empty {
806 type Uri = Unset;
807 type Title = Unset;
808 type Description = Unset;
809 }
810 pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
812 impl<S: State> sealed::Sealed for SetUri<S> {}
813 impl<S: State> State for SetUri<S> {
814 type Uri = Set<members::uri>;
815 type Title = S::Title;
816 type Description = S::Description;
817 }
818 pub struct SetTitle<S: State = Empty>(PhantomData<fn() -> S>);
820 impl<S: State> sealed::Sealed for SetTitle<S> {}
821 impl<S: State> State for SetTitle<S> {
822 type Uri = S::Uri;
823 type Title = Set<members::title>;
824 type Description = S::Description;
825 }
826 pub struct SetDescription<S: State = Empty>(PhantomData<fn() -> S>);
828 impl<S: State> sealed::Sealed for SetDescription<S> {}
829 impl<S: State> State for SetDescription<S> {
830 type Uri = S::Uri;
831 type Title = S::Title;
832 type Description = Set<members::description>;
833 }
834 #[allow(non_camel_case_types)]
836 pub mod members {
837 pub struct uri(());
839 pub struct title(());
841 pub struct description(());
843 }
844}
845
846pub struct ViewExternalBuilder<'a, S: view_external_state::State> {
848 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
849 __unsafe_private_named: (
850 ::core::option::Option<jacquard_common::CowStr<'a>>,
851 ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
852 ::core::option::Option<jacquard_common::CowStr<'a>>,
853 ::core::option::Option<jacquard_common::types::string::Uri<'a>>,
854 ),
855 _phantom: ::core::marker::PhantomData<&'a ()>,
856}
857
858impl<'a> ViewExternal<'a> {
859 pub fn new() -> ViewExternalBuilder<'a, view_external_state::Empty> {
861 ViewExternalBuilder::new()
862 }
863}
864
865impl<'a> ViewExternalBuilder<'a, view_external_state::Empty> {
866 pub fn new() -> Self {
868 ViewExternalBuilder {
869 _phantom_state: ::core::marker::PhantomData,
870 __unsafe_private_named: (None, None, None, None),
871 _phantom: ::core::marker::PhantomData,
872 }
873 }
874}
875
876impl<'a, S> ViewExternalBuilder<'a, S>
877where
878 S: view_external_state::State,
879 S::Description: view_external_state::IsUnset,
880{
881 pub fn description(
883 mut self,
884 value: impl Into<jacquard_common::CowStr<'a>>,
885 ) -> ViewExternalBuilder<'a, view_external_state::SetDescription<S>> {
886 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
887 ViewExternalBuilder {
888 _phantom_state: ::core::marker::PhantomData,
889 __unsafe_private_named: self.__unsafe_private_named,
890 _phantom: ::core::marker::PhantomData,
891 }
892 }
893}
894
895impl<'a, S: view_external_state::State> ViewExternalBuilder<'a, S> {
896 pub fn thumb(
898 mut self,
899 value: impl Into<Option<jacquard_common::types::string::Uri<'a>>>,
900 ) -> Self {
901 self.__unsafe_private_named.1 = value.into();
902 self
903 }
904 pub fn maybe_thumb(
906 mut self,
907 value: Option<jacquard_common::types::string::Uri<'a>>,
908 ) -> Self {
909 self.__unsafe_private_named.1 = value;
910 self
911 }
912}
913
914impl<'a, S> ViewExternalBuilder<'a, S>
915where
916 S: view_external_state::State,
917 S::Title: view_external_state::IsUnset,
918{
919 pub fn title(
921 mut self,
922 value: impl Into<jacquard_common::CowStr<'a>>,
923 ) -> ViewExternalBuilder<'a, view_external_state::SetTitle<S>> {
924 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
925 ViewExternalBuilder {
926 _phantom_state: ::core::marker::PhantomData,
927 __unsafe_private_named: self.__unsafe_private_named,
928 _phantom: ::core::marker::PhantomData,
929 }
930 }
931}
932
933impl<'a, S> ViewExternalBuilder<'a, S>
934where
935 S: view_external_state::State,
936 S::Uri: view_external_state::IsUnset,
937{
938 pub fn uri(
940 mut self,
941 value: impl Into<jacquard_common::types::string::Uri<'a>>,
942 ) -> ViewExternalBuilder<'a, view_external_state::SetUri<S>> {
943 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
944 ViewExternalBuilder {
945 _phantom_state: ::core::marker::PhantomData,
946 __unsafe_private_named: self.__unsafe_private_named,
947 _phantom: ::core::marker::PhantomData,
948 }
949 }
950}
951
952impl<'a, S> ViewExternalBuilder<'a, S>
953where
954 S: view_external_state::State,
955 S::Uri: view_external_state::IsSet,
956 S::Title: view_external_state::IsSet,
957 S::Description: view_external_state::IsSet,
958{
959 pub fn build(self) -> ViewExternal<'a> {
961 ViewExternal {
962 description: self.__unsafe_private_named.0.unwrap(),
963 thumb: self.__unsafe_private_named.1,
964 title: self.__unsafe_private_named.2.unwrap(),
965 uri: self.__unsafe_private_named.3.unwrap(),
966 extra_data: Default::default(),
967 }
968 }
969 pub fn build_with_data(
971 self,
972 extra_data: std::collections::BTreeMap<
973 jacquard_common::smol_str::SmolStr,
974 jacquard_common::types::value::Data<'a>,
975 >,
976 ) -> ViewExternal<'a> {
977 ViewExternal {
978 description: self.__unsafe_private_named.0.unwrap(),
979 thumb: self.__unsafe_private_named.1,
980 title: self.__unsafe_private_named.2.unwrap(),
981 uri: self.__unsafe_private_named.3.unwrap(),
982 extra_data: Some(extra_data),
983 }
984 }
985}
986
987impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ViewExternal<'a> {
988 fn nsid() -> &'static str {
989 "sh.weaver.embed.external"
990 }
991 fn def_name() -> &'static str {
992 "viewExternal"
993 }
994 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
995 lexicon_doc_sh_weaver_embed_external()
996 }
997 fn validate(
998 &self,
999 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1000 Ok(())
1001 }
1002}