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 Audio<'a> {
20 pub channels: i64,
21 #[serde(borrow)]
22 pub codec: jacquard_common::CowStr<'a>,
23 pub rate: i64,
24}
25
26pub mod audio_state {
27
28 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
29 #[allow(unused)]
30 use ::core::marker::PhantomData;
31 mod sealed {
32 pub trait Sealed {}
33 }
34 pub trait State: sealed::Sealed {
36 type Codec;
37 type Rate;
38 type Channels;
39 }
40 pub struct Empty(());
42 impl sealed::Sealed for Empty {}
43 impl State for Empty {
44 type Codec = Unset;
45 type Rate = Unset;
46 type Channels = Unset;
47 }
48 pub struct SetCodec<S: State = Empty>(PhantomData<fn() -> S>);
50 impl<S: State> sealed::Sealed for SetCodec<S> {}
51 impl<S: State> State for SetCodec<S> {
52 type Codec = Set<members::codec>;
53 type Rate = S::Rate;
54 type Channels = S::Channels;
55 }
56 pub struct SetRate<S: State = Empty>(PhantomData<fn() -> S>);
58 impl<S: State> sealed::Sealed for SetRate<S> {}
59 impl<S: State> State for SetRate<S> {
60 type Codec = S::Codec;
61 type Rate = Set<members::rate>;
62 type Channels = S::Channels;
63 }
64 pub struct SetChannels<S: State = Empty>(PhantomData<fn() -> S>);
66 impl<S: State> sealed::Sealed for SetChannels<S> {}
67 impl<S: State> State for SetChannels<S> {
68 type Codec = S::Codec;
69 type Rate = S::Rate;
70 type Channels = Set<members::channels>;
71 }
72 #[allow(non_camel_case_types)]
74 pub mod members {
75 pub struct codec(());
77 pub struct rate(());
79 pub struct channels(());
81 }
82}
83
84pub struct AudioBuilder<'a, S: audio_state::State> {
86 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
87 __unsafe_private_named: (
88 ::core::option::Option<i64>,
89 ::core::option::Option<jacquard_common::CowStr<'a>>,
90 ::core::option::Option<i64>,
91 ),
92 _phantom: ::core::marker::PhantomData<&'a ()>,
93}
94
95impl<'a> Audio<'a> {
96 pub fn new() -> AudioBuilder<'a, audio_state::Empty> {
98 AudioBuilder::new()
99 }
100}
101
102impl<'a> AudioBuilder<'a, audio_state::Empty> {
103 pub fn new() -> Self {
105 AudioBuilder {
106 _phantom_state: ::core::marker::PhantomData,
107 __unsafe_private_named: (None, None, None),
108 _phantom: ::core::marker::PhantomData,
109 }
110 }
111}
112
113impl<'a, S> AudioBuilder<'a, S>
114where
115 S: audio_state::State,
116 S::Channels: audio_state::IsUnset,
117{
118 pub fn channels(
120 mut self,
121 value: impl Into<i64>,
122 ) -> AudioBuilder<'a, audio_state::SetChannels<S>> {
123 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
124 AudioBuilder {
125 _phantom_state: ::core::marker::PhantomData,
126 __unsafe_private_named: self.__unsafe_private_named,
127 _phantom: ::core::marker::PhantomData,
128 }
129 }
130}
131
132impl<'a, S> AudioBuilder<'a, S>
133where
134 S: audio_state::State,
135 S::Codec: audio_state::IsUnset,
136{
137 pub fn codec(
139 mut self,
140 value: impl Into<jacquard_common::CowStr<'a>>,
141 ) -> AudioBuilder<'a, audio_state::SetCodec<S>> {
142 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
143 AudioBuilder {
144 _phantom_state: ::core::marker::PhantomData,
145 __unsafe_private_named: self.__unsafe_private_named,
146 _phantom: ::core::marker::PhantomData,
147 }
148 }
149}
150
151impl<'a, S> AudioBuilder<'a, S>
152where
153 S: audio_state::State,
154 S::Rate: audio_state::IsUnset,
155{
156 pub fn rate(
158 mut self,
159 value: impl Into<i64>,
160 ) -> AudioBuilder<'a, audio_state::SetRate<S>> {
161 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
162 AudioBuilder {
163 _phantom_state: ::core::marker::PhantomData,
164 __unsafe_private_named: self.__unsafe_private_named,
165 _phantom: ::core::marker::PhantomData,
166 }
167 }
168}
169
170impl<'a, S> AudioBuilder<'a, S>
171where
172 S: audio_state::State,
173 S::Codec: audio_state::IsSet,
174 S::Rate: audio_state::IsSet,
175 S::Channels: audio_state::IsSet,
176{
177 pub fn build(self) -> Audio<'a> {
179 Audio {
180 channels: self.__unsafe_private_named.0.unwrap(),
181 codec: self.__unsafe_private_named.1.unwrap(),
182 rate: self.__unsafe_private_named.2.unwrap(),
183 extra_data: Default::default(),
184 }
185 }
186 pub fn build_with_data(
188 self,
189 extra_data: std::collections::BTreeMap<
190 jacquard_common::smol_str::SmolStr,
191 jacquard_common::types::value::Data<'a>,
192 >,
193 ) -> Audio<'a> {
194 Audio {
195 channels: self.__unsafe_private_named.0.unwrap(),
196 codec: self.__unsafe_private_named.1.unwrap(),
197 rate: self.__unsafe_private_named.2.unwrap(),
198 extra_data: Some(extra_data),
199 }
200 }
201}
202
203fn lexicon_doc_place_stream_segment() -> ::jacquard_lexicon::lexicon::LexiconDoc<
204 'static,
205> {
206 ::jacquard_lexicon::lexicon::LexiconDoc {
207 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
208 id: ::jacquard_common::CowStr::new_static("place.stream.segment"),
209 revision: None,
210 description: None,
211 defs: {
212 let mut map = ::std::collections::BTreeMap::new();
213 map.insert(
214 ::jacquard_common::smol_str::SmolStr::new_static("audio"),
215 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
216 description: None,
217 required: Some(
218 vec![
219 ::jacquard_common::smol_str::SmolStr::new_static("codec"),
220 ::jacquard_common::smol_str::SmolStr::new_static("rate"),
221 ::jacquard_common::smol_str::SmolStr::new_static("channels")
222 ],
223 ),
224 nullable: None,
225 properties: {
226 #[allow(unused_mut)]
227 let mut map = ::std::collections::BTreeMap::new();
228 map.insert(
229 ::jacquard_common::smol_str::SmolStr::new_static("channels"),
230 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
231 description: None,
232 default: None,
233 minimum: None,
234 maximum: None,
235 r#enum: None,
236 r#const: None,
237 }),
238 );
239 map.insert(
240 ::jacquard_common::smol_str::SmolStr::new_static("codec"),
241 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
242 description: None,
243 format: None,
244 default: None,
245 min_length: None,
246 max_length: None,
247 min_graphemes: None,
248 max_graphemes: None,
249 r#enum: None,
250 r#const: None,
251 known_values: None,
252 }),
253 );
254 map.insert(
255 ::jacquard_common::smol_str::SmolStr::new_static("rate"),
256 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
257 description: None,
258 default: None,
259 minimum: None,
260 maximum: None,
261 r#enum: None,
262 r#const: None,
263 }),
264 );
265 map
266 },
267 }),
268 );
269 map.insert(
270 ::jacquard_common::smol_str::SmolStr::new_static("framerate"),
271 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
272 description: None,
273 required: Some(
274 vec![
275 ::jacquard_common::smol_str::SmolStr::new_static("num"),
276 ::jacquard_common::smol_str::SmolStr::new_static("den")
277 ],
278 ),
279 nullable: None,
280 properties: {
281 #[allow(unused_mut)]
282 let mut map = ::std::collections::BTreeMap::new();
283 map.insert(
284 ::jacquard_common::smol_str::SmolStr::new_static("den"),
285 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
286 description: None,
287 default: None,
288 minimum: None,
289 maximum: None,
290 r#enum: None,
291 r#const: None,
292 }),
293 );
294 map.insert(
295 ::jacquard_common::smol_str::SmolStr::new_static("num"),
296 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
297 description: None,
298 default: None,
299 minimum: None,
300 maximum: None,
301 r#enum: None,
302 r#const: None,
303 }),
304 );
305 map
306 },
307 }),
308 );
309 map.insert(
310 ::jacquard_common::smol_str::SmolStr::new_static("main"),
311 ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
312 description: Some(
313 ::jacquard_common::CowStr::new_static(
314 "Media file representing a segment of a livestream",
315 ),
316 ),
317 key: Some(::jacquard_common::CowStr::new_static("tid")),
318 record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
319 description: None,
320 required: Some(
321 vec![
322 ::jacquard_common::smol_str::SmolStr::new_static("id"),
323 ::jacquard_common::smol_str::SmolStr::new_static("signingKey"),
324 ::jacquard_common::smol_str::SmolStr::new_static("startTime"),
325 ::jacquard_common::smol_str::SmolStr::new_static("creator")
326 ],
327 ),
328 nullable: None,
329 properties: {
330 #[allow(unused_mut)]
331 let mut map = ::std::collections::BTreeMap::new();
332 map.insert(
333 ::jacquard_common::smol_str::SmolStr::new_static("audio"),
334 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
335 description: None,
336 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
337 description: None,
338 r#ref: ::jacquard_common::CowStr::new_static("#audio"),
339 }),
340 min_length: None,
341 max_length: None,
342 }),
343 );
344 map.insert(
345 ::jacquard_common::smol_str::SmolStr::new_static(
346 "contentRights",
347 ),
348 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
349 description: None,
350 r#ref: ::jacquard_common::CowStr::new_static(
351 "place.stream.metadata.contentRights",
352 ),
353 }),
354 );
355 map.insert(
356 ::jacquard_common::smol_str::SmolStr::new_static(
357 "contentWarnings",
358 ),
359 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
360 description: None,
361 r#ref: ::jacquard_common::CowStr::new_static(
362 "place.stream.metadata.contentWarnings",
363 ),
364 }),
365 );
366 map.insert(
367 ::jacquard_common::smol_str::SmolStr::new_static("creator"),
368 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
369 description: None,
370 format: Some(
371 ::jacquard_lexicon::lexicon::LexStringFormat::Did,
372 ),
373 default: None,
374 min_length: None,
375 max_length: None,
376 min_graphemes: None,
377 max_graphemes: None,
378 r#enum: None,
379 r#const: None,
380 known_values: None,
381 }),
382 );
383 map.insert(
384 ::jacquard_common::smol_str::SmolStr::new_static(
385 "distributionPolicy",
386 ),
387 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
388 description: None,
389 r#ref: ::jacquard_common::CowStr::new_static(
390 "place.stream.metadata.distributionPolicy",
391 ),
392 }),
393 );
394 map.insert(
395 ::jacquard_common::smol_str::SmolStr::new_static(
396 "duration",
397 ),
398 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
399 description: None,
400 default: None,
401 minimum: None,
402 maximum: None,
403 r#enum: None,
404 r#const: None,
405 }),
406 );
407 map.insert(
408 ::jacquard_common::smol_str::SmolStr::new_static("id"),
409 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
410 description: Some(
411 ::jacquard_common::CowStr::new_static(
412 "Unique identifier for the segment",
413 ),
414 ),
415 format: None,
416 default: None,
417 min_length: None,
418 max_length: None,
419 min_graphemes: None,
420 max_graphemes: None,
421 r#enum: None,
422 r#const: None,
423 known_values: None,
424 }),
425 );
426 map.insert(
427 ::jacquard_common::smol_str::SmolStr::new_static(
428 "signingKey",
429 ),
430 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
431 description: Some(
432 ::jacquard_common::CowStr::new_static(
433 "The DID of the signing key used for this segment",
434 ),
435 ),
436 format: None,
437 default: None,
438 min_length: None,
439 max_length: None,
440 min_graphemes: None,
441 max_graphemes: None,
442 r#enum: None,
443 r#const: None,
444 known_values: None,
445 }),
446 );
447 map.insert(
448 ::jacquard_common::smol_str::SmolStr::new_static("size"),
449 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
450 description: None,
451 default: None,
452 minimum: None,
453 maximum: None,
454 r#enum: None,
455 r#const: None,
456 }),
457 );
458 map.insert(
459 ::jacquard_common::smol_str::SmolStr::new_static(
460 "startTime",
461 ),
462 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
463 description: Some(
464 ::jacquard_common::CowStr::new_static(
465 "When this segment started",
466 ),
467 ),
468 format: Some(
469 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
470 ),
471 default: None,
472 min_length: None,
473 max_length: None,
474 min_graphemes: None,
475 max_graphemes: None,
476 r#enum: None,
477 r#const: None,
478 known_values: None,
479 }),
480 );
481 map.insert(
482 ::jacquard_common::smol_str::SmolStr::new_static("video"),
483 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
484 description: None,
485 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
486 description: None,
487 r#ref: ::jacquard_common::CowStr::new_static("#video"),
488 }),
489 min_length: None,
490 max_length: None,
491 }),
492 );
493 map
494 },
495 }),
496 }),
497 );
498 map.insert(
499 ::jacquard_common::smol_str::SmolStr::new_static("segmentView"),
500 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
501 description: None,
502 required: Some(
503 vec![
504 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
505 ::jacquard_common::smol_str::SmolStr::new_static("record")
506 ],
507 ),
508 nullable: None,
509 properties: {
510 #[allow(unused_mut)]
511 let mut map = ::std::collections::BTreeMap::new();
512 map.insert(
513 ::jacquard_common::smol_str::SmolStr::new_static("cid"),
514 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
515 description: None,
516 format: Some(
517 ::jacquard_lexicon::lexicon::LexStringFormat::Cid,
518 ),
519 default: None,
520 min_length: None,
521 max_length: None,
522 min_graphemes: None,
523 max_graphemes: None,
524 r#enum: None,
525 r#const: None,
526 known_values: None,
527 }),
528 );
529 map.insert(
530 ::jacquard_common::smol_str::SmolStr::new_static("record"),
531 ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown {
532 description: None,
533 }),
534 );
535 map
536 },
537 }),
538 );
539 map.insert(
540 ::jacquard_common::smol_str::SmolStr::new_static("video"),
541 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
542 description: None,
543 required: Some(
544 vec![
545 ::jacquard_common::smol_str::SmolStr::new_static("codec"),
546 ::jacquard_common::smol_str::SmolStr::new_static("width"),
547 ::jacquard_common::smol_str::SmolStr::new_static("height")
548 ],
549 ),
550 nullable: None,
551 properties: {
552 #[allow(unused_mut)]
553 let mut map = ::std::collections::BTreeMap::new();
554 map.insert(
555 ::jacquard_common::smol_str::SmolStr::new_static("bframes"),
556 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean {
557 description: None,
558 default: None,
559 r#const: None,
560 }),
561 );
562 map.insert(
563 ::jacquard_common::smol_str::SmolStr::new_static("codec"),
564 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
565 description: None,
566 format: None,
567 default: None,
568 min_length: None,
569 max_length: None,
570 min_graphemes: None,
571 max_graphemes: None,
572 r#enum: None,
573 r#const: None,
574 known_values: None,
575 }),
576 );
577 map.insert(
578 ::jacquard_common::smol_str::SmolStr::new_static(
579 "framerate",
580 ),
581 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
582 description: None,
583 r#ref: ::jacquard_common::CowStr::new_static("#framerate"),
584 }),
585 );
586 map.insert(
587 ::jacquard_common::smol_str::SmolStr::new_static("height"),
588 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
589 description: None,
590 default: None,
591 minimum: None,
592 maximum: None,
593 r#enum: None,
594 r#const: None,
595 }),
596 );
597 map.insert(
598 ::jacquard_common::smol_str::SmolStr::new_static("width"),
599 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
600 description: None,
601 default: None,
602 minimum: None,
603 maximum: None,
604 r#enum: None,
605 r#const: None,
606 }),
607 );
608 map
609 },
610 }),
611 );
612 map
613 },
614 }
615}
616
617impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Audio<'a> {
618 fn nsid() -> &'static str {
619 "place.stream.segment"
620 }
621 fn def_name() -> &'static str {
622 "audio"
623 }
624 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
625 lexicon_doc_place_stream_segment()
626 }
627 fn validate(
628 &self,
629 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
630 Ok(())
631 }
632}
633
634#[jacquard_derive::lexicon]
635#[derive(
636 serde::Serialize,
637 serde::Deserialize,
638 Debug,
639 Clone,
640 PartialEq,
641 Eq,
642 jacquard_derive::IntoStatic
643)]
644#[serde(rename_all = "camelCase")]
645pub struct Framerate<'a> {
646 pub den: i64,
647 pub num: i64,
648}
649
650pub mod framerate_state {
651
652 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
653 #[allow(unused)]
654 use ::core::marker::PhantomData;
655 mod sealed {
656 pub trait Sealed {}
657 }
658 pub trait State: sealed::Sealed {
660 type Num;
661 type Den;
662 }
663 pub struct Empty(());
665 impl sealed::Sealed for Empty {}
666 impl State for Empty {
667 type Num = Unset;
668 type Den = Unset;
669 }
670 pub struct SetNum<S: State = Empty>(PhantomData<fn() -> S>);
672 impl<S: State> sealed::Sealed for SetNum<S> {}
673 impl<S: State> State for SetNum<S> {
674 type Num = Set<members::num>;
675 type Den = S::Den;
676 }
677 pub struct SetDen<S: State = Empty>(PhantomData<fn() -> S>);
679 impl<S: State> sealed::Sealed for SetDen<S> {}
680 impl<S: State> State for SetDen<S> {
681 type Num = S::Num;
682 type Den = Set<members::den>;
683 }
684 #[allow(non_camel_case_types)]
686 pub mod members {
687 pub struct num(());
689 pub struct den(());
691 }
692}
693
694pub struct FramerateBuilder<'a, S: framerate_state::State> {
696 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
697 __unsafe_private_named: (::core::option::Option<i64>, ::core::option::Option<i64>),
698 _phantom: ::core::marker::PhantomData<&'a ()>,
699}
700
701impl<'a> Framerate<'a> {
702 pub fn new() -> FramerateBuilder<'a, framerate_state::Empty> {
704 FramerateBuilder::new()
705 }
706}
707
708impl<'a> FramerateBuilder<'a, framerate_state::Empty> {
709 pub fn new() -> Self {
711 FramerateBuilder {
712 _phantom_state: ::core::marker::PhantomData,
713 __unsafe_private_named: (None, None),
714 _phantom: ::core::marker::PhantomData,
715 }
716 }
717}
718
719impl<'a, S> FramerateBuilder<'a, S>
720where
721 S: framerate_state::State,
722 S::Den: framerate_state::IsUnset,
723{
724 pub fn den(
726 mut self,
727 value: impl Into<i64>,
728 ) -> FramerateBuilder<'a, framerate_state::SetDen<S>> {
729 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
730 FramerateBuilder {
731 _phantom_state: ::core::marker::PhantomData,
732 __unsafe_private_named: self.__unsafe_private_named,
733 _phantom: ::core::marker::PhantomData,
734 }
735 }
736}
737
738impl<'a, S> FramerateBuilder<'a, S>
739where
740 S: framerate_state::State,
741 S::Num: framerate_state::IsUnset,
742{
743 pub fn num(
745 mut self,
746 value: impl Into<i64>,
747 ) -> FramerateBuilder<'a, framerate_state::SetNum<S>> {
748 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
749 FramerateBuilder {
750 _phantom_state: ::core::marker::PhantomData,
751 __unsafe_private_named: self.__unsafe_private_named,
752 _phantom: ::core::marker::PhantomData,
753 }
754 }
755}
756
757impl<'a, S> FramerateBuilder<'a, S>
758where
759 S: framerate_state::State,
760 S::Num: framerate_state::IsSet,
761 S::Den: framerate_state::IsSet,
762{
763 pub fn build(self) -> Framerate<'a> {
765 Framerate {
766 den: self.__unsafe_private_named.0.unwrap(),
767 num: self.__unsafe_private_named.1.unwrap(),
768 extra_data: Default::default(),
769 }
770 }
771 pub fn build_with_data(
773 self,
774 extra_data: std::collections::BTreeMap<
775 jacquard_common::smol_str::SmolStr,
776 jacquard_common::types::value::Data<'a>,
777 >,
778 ) -> Framerate<'a> {
779 Framerate {
780 den: self.__unsafe_private_named.0.unwrap(),
781 num: self.__unsafe_private_named.1.unwrap(),
782 extra_data: Some(extra_data),
783 }
784 }
785}
786
787impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Framerate<'a> {
788 fn nsid() -> &'static str {
789 "place.stream.segment"
790 }
791 fn def_name() -> &'static str {
792 "framerate"
793 }
794 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
795 lexicon_doc_place_stream_segment()
796 }
797 fn validate(
798 &self,
799 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
800 Ok(())
801 }
802}
803
804#[jacquard_derive::lexicon]
806#[derive(
807 serde::Serialize,
808 serde::Deserialize,
809 Debug,
810 Clone,
811 PartialEq,
812 Eq,
813 jacquard_derive::IntoStatic
814)]
815#[serde(rename_all = "camelCase")]
816pub struct Segment<'a> {
817 #[serde(skip_serializing_if = "std::option::Option::is_none")]
818 #[serde(borrow)]
819 pub audio: Option<Vec<crate::place_stream::segment::Audio<'a>>>,
820 #[serde(skip_serializing_if = "std::option::Option::is_none")]
821 #[serde(borrow)]
822 pub content_rights: Option<
823 crate::place_stream::metadata::content_rights::ContentRights<'a>,
824 >,
825 #[serde(skip_serializing_if = "std::option::Option::is_none")]
826 #[serde(borrow)]
827 pub content_warnings: Option<
828 crate::place_stream::metadata::content_warnings::ContentWarnings<'a>,
829 >,
830 #[serde(borrow)]
831 pub creator: jacquard_common::types::string::Did<'a>,
832 #[serde(skip_serializing_if = "std::option::Option::is_none")]
833 #[serde(borrow)]
834 pub distribution_policy: Option<
835 crate::place_stream::metadata::distribution_policy::DistributionPolicy<'a>,
836 >,
837 #[serde(skip_serializing_if = "std::option::Option::is_none")]
839 pub duration: Option<i64>,
840 #[serde(borrow)]
842 pub id: jacquard_common::CowStr<'a>,
843 #[serde(borrow)]
845 pub signing_key: jacquard_common::CowStr<'a>,
846 #[serde(skip_serializing_if = "std::option::Option::is_none")]
848 pub size: Option<i64>,
849 pub start_time: jacquard_common::types::string::Datetime,
851 #[serde(skip_serializing_if = "std::option::Option::is_none")]
852 #[serde(borrow)]
853 pub video: Option<Vec<crate::place_stream::segment::Video<'a>>>,
854}
855
856pub mod segment_state {
857
858 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
859 #[allow(unused)]
860 use ::core::marker::PhantomData;
861 mod sealed {
862 pub trait Sealed {}
863 }
864 pub trait State: sealed::Sealed {
866 type Id;
867 type SigningKey;
868 type StartTime;
869 type Creator;
870 }
871 pub struct Empty(());
873 impl sealed::Sealed for Empty {}
874 impl State for Empty {
875 type Id = Unset;
876 type SigningKey = Unset;
877 type StartTime = Unset;
878 type Creator = Unset;
879 }
880 pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
882 impl<S: State> sealed::Sealed for SetId<S> {}
883 impl<S: State> State for SetId<S> {
884 type Id = Set<members::id>;
885 type SigningKey = S::SigningKey;
886 type StartTime = S::StartTime;
887 type Creator = S::Creator;
888 }
889 pub struct SetSigningKey<S: State = Empty>(PhantomData<fn() -> S>);
891 impl<S: State> sealed::Sealed for SetSigningKey<S> {}
892 impl<S: State> State for SetSigningKey<S> {
893 type Id = S::Id;
894 type SigningKey = Set<members::signing_key>;
895 type StartTime = S::StartTime;
896 type Creator = S::Creator;
897 }
898 pub struct SetStartTime<S: State = Empty>(PhantomData<fn() -> S>);
900 impl<S: State> sealed::Sealed for SetStartTime<S> {}
901 impl<S: State> State for SetStartTime<S> {
902 type Id = S::Id;
903 type SigningKey = S::SigningKey;
904 type StartTime = Set<members::start_time>;
905 type Creator = S::Creator;
906 }
907 pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>);
909 impl<S: State> sealed::Sealed for SetCreator<S> {}
910 impl<S: State> State for SetCreator<S> {
911 type Id = S::Id;
912 type SigningKey = S::SigningKey;
913 type StartTime = S::StartTime;
914 type Creator = Set<members::creator>;
915 }
916 #[allow(non_camel_case_types)]
918 pub mod members {
919 pub struct id(());
921 pub struct signing_key(());
923 pub struct start_time(());
925 pub struct creator(());
927 }
928}
929
930pub struct SegmentBuilder<'a, S: segment_state::State> {
932 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
933 __unsafe_private_named: (
934 ::core::option::Option<Vec<crate::place_stream::segment::Audio<'a>>>,
935 ::core::option::Option<
936 crate::place_stream::metadata::content_rights::ContentRights<'a>,
937 >,
938 ::core::option::Option<
939 crate::place_stream::metadata::content_warnings::ContentWarnings<'a>,
940 >,
941 ::core::option::Option<jacquard_common::types::string::Did<'a>>,
942 ::core::option::Option<
943 crate::place_stream::metadata::distribution_policy::DistributionPolicy<'a>,
944 >,
945 ::core::option::Option<i64>,
946 ::core::option::Option<jacquard_common::CowStr<'a>>,
947 ::core::option::Option<jacquard_common::CowStr<'a>>,
948 ::core::option::Option<i64>,
949 ::core::option::Option<jacquard_common::types::string::Datetime>,
950 ::core::option::Option<Vec<crate::place_stream::segment::Video<'a>>>,
951 ),
952 _phantom: ::core::marker::PhantomData<&'a ()>,
953}
954
955impl<'a> Segment<'a> {
956 pub fn new() -> SegmentBuilder<'a, segment_state::Empty> {
958 SegmentBuilder::new()
959 }
960}
961
962impl<'a> SegmentBuilder<'a, segment_state::Empty> {
963 pub fn new() -> Self {
965 SegmentBuilder {
966 _phantom_state: ::core::marker::PhantomData,
967 __unsafe_private_named: (
968 None,
969 None,
970 None,
971 None,
972 None,
973 None,
974 None,
975 None,
976 None,
977 None,
978 None,
979 ),
980 _phantom: ::core::marker::PhantomData,
981 }
982 }
983}
984
985impl<'a, S: segment_state::State> SegmentBuilder<'a, S> {
986 pub fn audio(
988 mut self,
989 value: impl Into<Option<Vec<crate::place_stream::segment::Audio<'a>>>>,
990 ) -> Self {
991 self.__unsafe_private_named.0 = value.into();
992 self
993 }
994 pub fn maybe_audio(
996 mut self,
997 value: Option<Vec<crate::place_stream::segment::Audio<'a>>>,
998 ) -> Self {
999 self.__unsafe_private_named.0 = value;
1000 self
1001 }
1002}
1003
1004impl<'a, S: segment_state::State> SegmentBuilder<'a, S> {
1005 pub fn content_rights(
1007 mut self,
1008 value: impl Into<
1009 Option<crate::place_stream::metadata::content_rights::ContentRights<'a>>,
1010 >,
1011 ) -> Self {
1012 self.__unsafe_private_named.1 = value.into();
1013 self
1014 }
1015 pub fn maybe_content_rights(
1017 mut self,
1018 value: Option<crate::place_stream::metadata::content_rights::ContentRights<'a>>,
1019 ) -> Self {
1020 self.__unsafe_private_named.1 = value;
1021 self
1022 }
1023}
1024
1025impl<'a, S: segment_state::State> SegmentBuilder<'a, S> {
1026 pub fn content_warnings(
1028 mut self,
1029 value: impl Into<
1030 Option<crate::place_stream::metadata::content_warnings::ContentWarnings<'a>>,
1031 >,
1032 ) -> Self {
1033 self.__unsafe_private_named.2 = value.into();
1034 self
1035 }
1036 pub fn maybe_content_warnings(
1038 mut self,
1039 value: Option<
1040 crate::place_stream::metadata::content_warnings::ContentWarnings<'a>,
1041 >,
1042 ) -> Self {
1043 self.__unsafe_private_named.2 = value;
1044 self
1045 }
1046}
1047
1048impl<'a, S> SegmentBuilder<'a, S>
1049where
1050 S: segment_state::State,
1051 S::Creator: segment_state::IsUnset,
1052{
1053 pub fn creator(
1055 mut self,
1056 value: impl Into<jacquard_common::types::string::Did<'a>>,
1057 ) -> SegmentBuilder<'a, segment_state::SetCreator<S>> {
1058 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
1059 SegmentBuilder {
1060 _phantom_state: ::core::marker::PhantomData,
1061 __unsafe_private_named: self.__unsafe_private_named,
1062 _phantom: ::core::marker::PhantomData,
1063 }
1064 }
1065}
1066
1067impl<'a, S: segment_state::State> SegmentBuilder<'a, S> {
1068 pub fn distribution_policy(
1070 mut self,
1071 value: impl Into<
1072 Option<
1073 crate::place_stream::metadata::distribution_policy::DistributionPolicy<
1074 'a,
1075 >,
1076 >,
1077 >,
1078 ) -> Self {
1079 self.__unsafe_private_named.4 = value.into();
1080 self
1081 }
1082 pub fn maybe_distribution_policy(
1084 mut self,
1085 value: Option<
1086 crate::place_stream::metadata::distribution_policy::DistributionPolicy<'a>,
1087 >,
1088 ) -> Self {
1089 self.__unsafe_private_named.4 = value;
1090 self
1091 }
1092}
1093
1094impl<'a, S: segment_state::State> SegmentBuilder<'a, S> {
1095 pub fn duration(mut self, value: impl Into<Option<i64>>) -> Self {
1097 self.__unsafe_private_named.5 = value.into();
1098 self
1099 }
1100 pub fn maybe_duration(mut self, value: Option<i64>) -> Self {
1102 self.__unsafe_private_named.5 = value;
1103 self
1104 }
1105}
1106
1107impl<'a, S> SegmentBuilder<'a, S>
1108where
1109 S: segment_state::State,
1110 S::Id: segment_state::IsUnset,
1111{
1112 pub fn id(
1114 mut self,
1115 value: impl Into<jacquard_common::CowStr<'a>>,
1116 ) -> SegmentBuilder<'a, segment_state::SetId<S>> {
1117 self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into());
1118 SegmentBuilder {
1119 _phantom_state: ::core::marker::PhantomData,
1120 __unsafe_private_named: self.__unsafe_private_named,
1121 _phantom: ::core::marker::PhantomData,
1122 }
1123 }
1124}
1125
1126impl<'a, S> SegmentBuilder<'a, S>
1127where
1128 S: segment_state::State,
1129 S::SigningKey: segment_state::IsUnset,
1130{
1131 pub fn signing_key(
1133 mut self,
1134 value: impl Into<jacquard_common::CowStr<'a>>,
1135 ) -> SegmentBuilder<'a, segment_state::SetSigningKey<S>> {
1136 self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into());
1137 SegmentBuilder {
1138 _phantom_state: ::core::marker::PhantomData,
1139 __unsafe_private_named: self.__unsafe_private_named,
1140 _phantom: ::core::marker::PhantomData,
1141 }
1142 }
1143}
1144
1145impl<'a, S: segment_state::State> SegmentBuilder<'a, S> {
1146 pub fn size(mut self, value: impl Into<Option<i64>>) -> Self {
1148 self.__unsafe_private_named.8 = value.into();
1149 self
1150 }
1151 pub fn maybe_size(mut self, value: Option<i64>) -> Self {
1153 self.__unsafe_private_named.8 = value;
1154 self
1155 }
1156}
1157
1158impl<'a, S> SegmentBuilder<'a, S>
1159where
1160 S: segment_state::State,
1161 S::StartTime: segment_state::IsUnset,
1162{
1163 pub fn start_time(
1165 mut self,
1166 value: impl Into<jacquard_common::types::string::Datetime>,
1167 ) -> SegmentBuilder<'a, segment_state::SetStartTime<S>> {
1168 self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into());
1169 SegmentBuilder {
1170 _phantom_state: ::core::marker::PhantomData,
1171 __unsafe_private_named: self.__unsafe_private_named,
1172 _phantom: ::core::marker::PhantomData,
1173 }
1174 }
1175}
1176
1177impl<'a, S: segment_state::State> SegmentBuilder<'a, S> {
1178 pub fn video(
1180 mut self,
1181 value: impl Into<Option<Vec<crate::place_stream::segment::Video<'a>>>>,
1182 ) -> Self {
1183 self.__unsafe_private_named.10 = value.into();
1184 self
1185 }
1186 pub fn maybe_video(
1188 mut self,
1189 value: Option<Vec<crate::place_stream::segment::Video<'a>>>,
1190 ) -> Self {
1191 self.__unsafe_private_named.10 = value;
1192 self
1193 }
1194}
1195
1196impl<'a, S> SegmentBuilder<'a, S>
1197where
1198 S: segment_state::State,
1199 S::Id: segment_state::IsSet,
1200 S::SigningKey: segment_state::IsSet,
1201 S::StartTime: segment_state::IsSet,
1202 S::Creator: segment_state::IsSet,
1203{
1204 pub fn build(self) -> Segment<'a> {
1206 Segment {
1207 audio: self.__unsafe_private_named.0,
1208 content_rights: self.__unsafe_private_named.1,
1209 content_warnings: self.__unsafe_private_named.2,
1210 creator: self.__unsafe_private_named.3.unwrap(),
1211 distribution_policy: self.__unsafe_private_named.4,
1212 duration: self.__unsafe_private_named.5,
1213 id: self.__unsafe_private_named.6.unwrap(),
1214 signing_key: self.__unsafe_private_named.7.unwrap(),
1215 size: self.__unsafe_private_named.8,
1216 start_time: self.__unsafe_private_named.9.unwrap(),
1217 video: self.__unsafe_private_named.10,
1218 extra_data: Default::default(),
1219 }
1220 }
1221 pub fn build_with_data(
1223 self,
1224 extra_data: std::collections::BTreeMap<
1225 jacquard_common::smol_str::SmolStr,
1226 jacquard_common::types::value::Data<'a>,
1227 >,
1228 ) -> Segment<'a> {
1229 Segment {
1230 audio: self.__unsafe_private_named.0,
1231 content_rights: self.__unsafe_private_named.1,
1232 content_warnings: self.__unsafe_private_named.2,
1233 creator: self.__unsafe_private_named.3.unwrap(),
1234 distribution_policy: self.__unsafe_private_named.4,
1235 duration: self.__unsafe_private_named.5,
1236 id: self.__unsafe_private_named.6.unwrap(),
1237 signing_key: self.__unsafe_private_named.7.unwrap(),
1238 size: self.__unsafe_private_named.8,
1239 start_time: self.__unsafe_private_named.9.unwrap(),
1240 video: self.__unsafe_private_named.10,
1241 extra_data: Some(extra_data),
1242 }
1243 }
1244}
1245
1246impl<'a> Segment<'a> {
1247 pub fn uri(
1248 uri: impl Into<jacquard_common::CowStr<'a>>,
1249 ) -> Result<
1250 jacquard_common::types::uri::RecordUri<'a, SegmentRecord>,
1251 jacquard_common::types::uri::UriError,
1252 > {
1253 jacquard_common::types::uri::RecordUri::try_from_uri(
1254 jacquard_common::types::string::AtUri::new_cow(uri.into())?,
1255 )
1256 }
1257}
1258
1259#[derive(
1261 serde::Serialize,
1262 serde::Deserialize,
1263 Debug,
1264 Clone,
1265 PartialEq,
1266 Eq,
1267 jacquard_derive::IntoStatic
1268)]
1269#[serde(rename_all = "camelCase")]
1270pub struct SegmentGetRecordOutput<'a> {
1271 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1272 #[serde(borrow)]
1273 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
1274 #[serde(borrow)]
1275 pub uri: jacquard_common::types::string::AtUri<'a>,
1276 #[serde(borrow)]
1277 pub value: Segment<'a>,
1278}
1279
1280impl From<SegmentGetRecordOutput<'_>> for Segment<'_> {
1281 fn from(output: SegmentGetRecordOutput<'_>) -> Self {
1282 use jacquard_common::IntoStatic;
1283 output.value.into_static()
1284 }
1285}
1286
1287impl jacquard_common::types::collection::Collection for Segment<'_> {
1288 const NSID: &'static str = "place.stream.segment";
1289 type Record = SegmentRecord;
1290}
1291
1292#[derive(Debug, serde::Serialize, serde::Deserialize)]
1294pub struct SegmentRecord;
1295impl jacquard_common::xrpc::XrpcResp for SegmentRecord {
1296 const NSID: &'static str = "place.stream.segment";
1297 const ENCODING: &'static str = "application/json";
1298 type Output<'de> = SegmentGetRecordOutput<'de>;
1299 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
1300}
1301
1302impl jacquard_common::types::collection::Collection for SegmentRecord {
1303 const NSID: &'static str = "place.stream.segment";
1304 type Record = SegmentRecord;
1305}
1306
1307impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Segment<'a> {
1308 fn nsid() -> &'static str {
1309 "place.stream.segment"
1310 }
1311 fn def_name() -> &'static str {
1312 "main"
1313 }
1314 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1315 lexicon_doc_place_stream_segment()
1316 }
1317 fn validate(
1318 &self,
1319 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1320 Ok(())
1321 }
1322}
1323
1324#[jacquard_derive::lexicon]
1325#[derive(
1326 serde::Serialize,
1327 serde::Deserialize,
1328 Debug,
1329 Clone,
1330 PartialEq,
1331 Eq,
1332 jacquard_derive::IntoStatic
1333)]
1334#[serde(rename_all = "camelCase")]
1335pub struct SegmentView<'a> {
1336 #[serde(borrow)]
1337 pub cid: jacquard_common::types::string::Cid<'a>,
1338 #[serde(borrow)]
1339 pub record: jacquard_common::types::value::Data<'a>,
1340}
1341
1342pub mod segment_view_state {
1343
1344 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1345 #[allow(unused)]
1346 use ::core::marker::PhantomData;
1347 mod sealed {
1348 pub trait Sealed {}
1349 }
1350 pub trait State: sealed::Sealed {
1352 type Cid;
1353 type Record;
1354 }
1355 pub struct Empty(());
1357 impl sealed::Sealed for Empty {}
1358 impl State for Empty {
1359 type Cid = Unset;
1360 type Record = Unset;
1361 }
1362 pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
1364 impl<S: State> sealed::Sealed for SetCid<S> {}
1365 impl<S: State> State for SetCid<S> {
1366 type Cid = Set<members::cid>;
1367 type Record = S::Record;
1368 }
1369 pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
1371 impl<S: State> sealed::Sealed for SetRecord<S> {}
1372 impl<S: State> State for SetRecord<S> {
1373 type Cid = S::Cid;
1374 type Record = Set<members::record>;
1375 }
1376 #[allow(non_camel_case_types)]
1378 pub mod members {
1379 pub struct cid(());
1381 pub struct record(());
1383 }
1384}
1385
1386pub struct SegmentViewBuilder<'a, S: segment_view_state::State> {
1388 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1389 __unsafe_private_named: (
1390 ::core::option::Option<jacquard_common::types::string::Cid<'a>>,
1391 ::core::option::Option<jacquard_common::types::value::Data<'a>>,
1392 ),
1393 _phantom: ::core::marker::PhantomData<&'a ()>,
1394}
1395
1396impl<'a> SegmentView<'a> {
1397 pub fn new() -> SegmentViewBuilder<'a, segment_view_state::Empty> {
1399 SegmentViewBuilder::new()
1400 }
1401}
1402
1403impl<'a> SegmentViewBuilder<'a, segment_view_state::Empty> {
1404 pub fn new() -> Self {
1406 SegmentViewBuilder {
1407 _phantom_state: ::core::marker::PhantomData,
1408 __unsafe_private_named: (None, None),
1409 _phantom: ::core::marker::PhantomData,
1410 }
1411 }
1412}
1413
1414impl<'a, S> SegmentViewBuilder<'a, S>
1415where
1416 S: segment_view_state::State,
1417 S::Cid: segment_view_state::IsUnset,
1418{
1419 pub fn cid(
1421 mut self,
1422 value: impl Into<jacquard_common::types::string::Cid<'a>>,
1423 ) -> SegmentViewBuilder<'a, segment_view_state::SetCid<S>> {
1424 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
1425 SegmentViewBuilder {
1426 _phantom_state: ::core::marker::PhantomData,
1427 __unsafe_private_named: self.__unsafe_private_named,
1428 _phantom: ::core::marker::PhantomData,
1429 }
1430 }
1431}
1432
1433impl<'a, S> SegmentViewBuilder<'a, S>
1434where
1435 S: segment_view_state::State,
1436 S::Record: segment_view_state::IsUnset,
1437{
1438 pub fn record(
1440 mut self,
1441 value: impl Into<jacquard_common::types::value::Data<'a>>,
1442 ) -> SegmentViewBuilder<'a, segment_view_state::SetRecord<S>> {
1443 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1444 SegmentViewBuilder {
1445 _phantom_state: ::core::marker::PhantomData,
1446 __unsafe_private_named: self.__unsafe_private_named,
1447 _phantom: ::core::marker::PhantomData,
1448 }
1449 }
1450}
1451
1452impl<'a, S> SegmentViewBuilder<'a, S>
1453where
1454 S: segment_view_state::State,
1455 S::Cid: segment_view_state::IsSet,
1456 S::Record: segment_view_state::IsSet,
1457{
1458 pub fn build(self) -> SegmentView<'a> {
1460 SegmentView {
1461 cid: self.__unsafe_private_named.0.unwrap(),
1462 record: self.__unsafe_private_named.1.unwrap(),
1463 extra_data: Default::default(),
1464 }
1465 }
1466 pub fn build_with_data(
1468 self,
1469 extra_data: std::collections::BTreeMap<
1470 jacquard_common::smol_str::SmolStr,
1471 jacquard_common::types::value::Data<'a>,
1472 >,
1473 ) -> SegmentView<'a> {
1474 SegmentView {
1475 cid: self.__unsafe_private_named.0.unwrap(),
1476 record: self.__unsafe_private_named.1.unwrap(),
1477 extra_data: Some(extra_data),
1478 }
1479 }
1480}
1481
1482impl<'a> ::jacquard_lexicon::schema::LexiconSchema for SegmentView<'a> {
1483 fn nsid() -> &'static str {
1484 "place.stream.segment"
1485 }
1486 fn def_name() -> &'static str {
1487 "segmentView"
1488 }
1489 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1490 lexicon_doc_place_stream_segment()
1491 }
1492 fn validate(
1493 &self,
1494 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1495 Ok(())
1496 }
1497}
1498
1499#[jacquard_derive::lexicon]
1500#[derive(
1501 serde::Serialize,
1502 serde::Deserialize,
1503 Debug,
1504 Clone,
1505 PartialEq,
1506 Eq,
1507 jacquard_derive::IntoStatic
1508)]
1509#[serde(rename_all = "camelCase")]
1510pub struct Video<'a> {
1511 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1512 pub bframes: Option<bool>,
1513 #[serde(borrow)]
1514 pub codec: jacquard_common::CowStr<'a>,
1515 #[serde(skip_serializing_if = "std::option::Option::is_none")]
1516 #[serde(borrow)]
1517 pub framerate: Option<crate::place_stream::segment::Framerate<'a>>,
1518 pub height: i64,
1519 pub width: i64,
1520}
1521
1522pub mod video_state {
1523
1524 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1525 #[allow(unused)]
1526 use ::core::marker::PhantomData;
1527 mod sealed {
1528 pub trait Sealed {}
1529 }
1530 pub trait State: sealed::Sealed {
1532 type Codec;
1533 type Width;
1534 type Height;
1535 }
1536 pub struct Empty(());
1538 impl sealed::Sealed for Empty {}
1539 impl State for Empty {
1540 type Codec = Unset;
1541 type Width = Unset;
1542 type Height = Unset;
1543 }
1544 pub struct SetCodec<S: State = Empty>(PhantomData<fn() -> S>);
1546 impl<S: State> sealed::Sealed for SetCodec<S> {}
1547 impl<S: State> State for SetCodec<S> {
1548 type Codec = Set<members::codec>;
1549 type Width = S::Width;
1550 type Height = S::Height;
1551 }
1552 pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>);
1554 impl<S: State> sealed::Sealed for SetWidth<S> {}
1555 impl<S: State> State for SetWidth<S> {
1556 type Codec = S::Codec;
1557 type Width = Set<members::width>;
1558 type Height = S::Height;
1559 }
1560 pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>);
1562 impl<S: State> sealed::Sealed for SetHeight<S> {}
1563 impl<S: State> State for SetHeight<S> {
1564 type Codec = S::Codec;
1565 type Width = S::Width;
1566 type Height = Set<members::height>;
1567 }
1568 #[allow(non_camel_case_types)]
1570 pub mod members {
1571 pub struct codec(());
1573 pub struct width(());
1575 pub struct height(());
1577 }
1578}
1579
1580pub struct VideoBuilder<'a, S: video_state::State> {
1582 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
1583 __unsafe_private_named: (
1584 ::core::option::Option<bool>,
1585 ::core::option::Option<jacquard_common::CowStr<'a>>,
1586 ::core::option::Option<crate::place_stream::segment::Framerate<'a>>,
1587 ::core::option::Option<i64>,
1588 ::core::option::Option<i64>,
1589 ),
1590 _phantom: ::core::marker::PhantomData<&'a ()>,
1591}
1592
1593impl<'a> Video<'a> {
1594 pub fn new() -> VideoBuilder<'a, video_state::Empty> {
1596 VideoBuilder::new()
1597 }
1598}
1599
1600impl<'a> VideoBuilder<'a, video_state::Empty> {
1601 pub fn new() -> Self {
1603 VideoBuilder {
1604 _phantom_state: ::core::marker::PhantomData,
1605 __unsafe_private_named: (None, None, None, None, None),
1606 _phantom: ::core::marker::PhantomData,
1607 }
1608 }
1609}
1610
1611impl<'a, S: video_state::State> VideoBuilder<'a, S> {
1612 pub fn bframes(mut self, value: impl Into<Option<bool>>) -> Self {
1614 self.__unsafe_private_named.0 = value.into();
1615 self
1616 }
1617 pub fn maybe_bframes(mut self, value: Option<bool>) -> Self {
1619 self.__unsafe_private_named.0 = value;
1620 self
1621 }
1622}
1623
1624impl<'a, S> VideoBuilder<'a, S>
1625where
1626 S: video_state::State,
1627 S::Codec: video_state::IsUnset,
1628{
1629 pub fn codec(
1631 mut self,
1632 value: impl Into<jacquard_common::CowStr<'a>>,
1633 ) -> VideoBuilder<'a, video_state::SetCodec<S>> {
1634 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
1635 VideoBuilder {
1636 _phantom_state: ::core::marker::PhantomData,
1637 __unsafe_private_named: self.__unsafe_private_named,
1638 _phantom: ::core::marker::PhantomData,
1639 }
1640 }
1641}
1642
1643impl<'a, S: video_state::State> VideoBuilder<'a, S> {
1644 pub fn framerate(
1646 mut self,
1647 value: impl Into<Option<crate::place_stream::segment::Framerate<'a>>>,
1648 ) -> Self {
1649 self.__unsafe_private_named.2 = value.into();
1650 self
1651 }
1652 pub fn maybe_framerate(
1654 mut self,
1655 value: Option<crate::place_stream::segment::Framerate<'a>>,
1656 ) -> Self {
1657 self.__unsafe_private_named.2 = value;
1658 self
1659 }
1660}
1661
1662impl<'a, S> VideoBuilder<'a, S>
1663where
1664 S: video_state::State,
1665 S::Height: video_state::IsUnset,
1666{
1667 pub fn height(
1669 mut self,
1670 value: impl Into<i64>,
1671 ) -> VideoBuilder<'a, video_state::SetHeight<S>> {
1672 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
1673 VideoBuilder {
1674 _phantom_state: ::core::marker::PhantomData,
1675 __unsafe_private_named: self.__unsafe_private_named,
1676 _phantom: ::core::marker::PhantomData,
1677 }
1678 }
1679}
1680
1681impl<'a, S> VideoBuilder<'a, S>
1682where
1683 S: video_state::State,
1684 S::Width: video_state::IsUnset,
1685{
1686 pub fn width(
1688 mut self,
1689 value: impl Into<i64>,
1690 ) -> VideoBuilder<'a, video_state::SetWidth<S>> {
1691 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
1692 VideoBuilder {
1693 _phantom_state: ::core::marker::PhantomData,
1694 __unsafe_private_named: self.__unsafe_private_named,
1695 _phantom: ::core::marker::PhantomData,
1696 }
1697 }
1698}
1699
1700impl<'a, S> VideoBuilder<'a, S>
1701where
1702 S: video_state::State,
1703 S::Codec: video_state::IsSet,
1704 S::Width: video_state::IsSet,
1705 S::Height: video_state::IsSet,
1706{
1707 pub fn build(self) -> Video<'a> {
1709 Video {
1710 bframes: self.__unsafe_private_named.0,
1711 codec: self.__unsafe_private_named.1.unwrap(),
1712 framerate: self.__unsafe_private_named.2,
1713 height: self.__unsafe_private_named.3.unwrap(),
1714 width: self.__unsafe_private_named.4.unwrap(),
1715 extra_data: Default::default(),
1716 }
1717 }
1718 pub fn build_with_data(
1720 self,
1721 extra_data: std::collections::BTreeMap<
1722 jacquard_common::smol_str::SmolStr,
1723 jacquard_common::types::value::Data<'a>,
1724 >,
1725 ) -> Video<'a> {
1726 Video {
1727 bframes: self.__unsafe_private_named.0,
1728 codec: self.__unsafe_private_named.1.unwrap(),
1729 framerate: self.__unsafe_private_named.2,
1730 height: self.__unsafe_private_named.3.unwrap(),
1731 width: self.__unsafe_private_named.4.unwrap(),
1732 extra_data: Some(extra_data),
1733 }
1734 }
1735}
1736
1737impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Video<'a> {
1738 fn nsid() -> &'static str {
1739 "place.stream.segment"
1740 }
1741 fn def_name() -> &'static str {
1742 "video"
1743 }
1744 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
1745 lexicon_doc_place_stream_segment()
1746 }
1747 fn validate(
1748 &self,
1749 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
1750 Ok(())
1751 }
1752}