Something went wrong. Try again.
atproto made easy crates.io/crates/jacquard
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498// @generated by jacquard-lexicon. DO NOT EDIT.//// Lexicon: place.stream.segment//// This file was automatically generated from Lexicon schemas.// Any manual changes will be overwritten on the next regeneration.
#[allow(unused_imports)]use alloc::collections::BTreeMap;
#[allow(unused_imports)]use core::marker::PhantomData;use jacquard_common::CowStr;
#[allow(unused_imports)]use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;use jacquard_common::types::collection::{Collection, RecordError};use jacquard_common::types::string::{Did, AtUri, Cid, Datetime};use jacquard_common::types::uri::{RecordUri, UriError};use jacquard_common::types::value::Data;use jacquard_common::xrpc::XrpcResp;use jacquard_derive::{IntoStatic, lexicon};use jacquard_lexicon::lexicon::LexiconDoc;use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]use jacquard_lexicon::validation::{ConstraintError, ValidationPath};use serde::{Serialize, Deserialize};use crate::place_stream::metadata::content_rights::ContentRights;use crate::place_stream::metadata::content_warnings::ContentWarnings;use crate::place_stream::metadata::distribution_policy::DistributionPolicy;use crate::place_stream::segment;
#[lexicon]#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase")]pub struct Audio<'a> { pub channels: i64, #[serde(borrow)] pub codec: CowStr<'a>, pub rate: i64,}
#[lexicon]#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase")]pub struct Framerate<'a> { pub den: i64, pub num: i64,}
/// Media file representing a segment of a livestream
#[lexicon]#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase")]pub struct Segment<'a> { #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub audio: Option<Vec<segment::Audio<'a>>>, #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub content_rights: Option<ContentRights<'a>>, #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub content_warnings: Option<ContentWarnings<'a>>, #[serde(borrow)] pub creator: Did<'a>, #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub distribution_policy: Option<DistributionPolicy<'a>>, ///The duration of the segment in nanoseconds #[serde(skip_serializing_if = "Option::is_none")] pub duration: Option<i64>, ///Unique identifier for the segment #[serde(borrow)] pub id: CowStr<'a>, ///The DID of the signing key used for this segment #[serde(borrow)] pub signing_key: CowStr<'a>, ///The size of the segment in bytes #[serde(skip_serializing_if = "Option::is_none")] pub size: Option<i64>, ///When this segment started pub start_time: Datetime, #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub video: Option<Vec<segment::Video<'a>>>,}
/// Typed wrapper for GetRecord response with this collection's record type.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase")]pub struct SegmentGetRecordOutput<'a> { #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub cid: Option<Cid<'a>>, #[serde(borrow)] pub uri: AtUri<'a>, #[serde(borrow)] pub value: Segment<'a>,}
#[lexicon]#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase")]pub struct SegmentView<'a> { #[serde(borrow)] pub cid: Cid<'a>, #[serde(borrow)] pub record: Data<'a>,}
#[lexicon]#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase")]pub struct Video<'a> { #[serde(skip_serializing_if = "Option::is_none")] pub bframes: Option<bool>, #[serde(borrow)] pub codec: CowStr<'a>, #[serde(skip_serializing_if = "Option::is_none")] #[serde(borrow)] pub framerate: Option<segment::Framerate<'a>>, pub height: i64, pub width: i64,}
impl<'a> Segment<'a> { pub fn uri( uri: impl Into<CowStr<'a>>, ) -> Result<RecordUri<'a, SegmentRecord>, UriError> { RecordUri::try_from_uri(AtUri::new_cow(uri.into())?) }}
impl<'a> LexiconSchema for Audio<'a> { fn nsid() -> &'static str { "place.stream.segment" } fn def_name() -> &'static str { "audio" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_place_stream_segment() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
impl<'a> LexiconSchema for Framerate<'a> { fn nsid() -> &'static str { "place.stream.segment" } fn def_name() -> &'static str { "framerate" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_place_stream_segment() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
/// Marker type for deserializing records from this collection.
#[derive(Debug, Serialize, Deserialize)]pub struct SegmentRecord;impl XrpcResp for SegmentRecord { const NSID: &'static str = "place.stream.segment"; const ENCODING: &'static str = "application/json"; type Output<'de> = SegmentGetRecordOutput<'de>; type Err<'de> = RecordError<'de>;}
impl From<SegmentGetRecordOutput<'_>> for Segment<'_> { fn from(output: SegmentGetRecordOutput<'_>) -> Self { use jacquard_common::IntoStatic; output.value.into_static() }}
impl Collection for Segment<'_> { const NSID: &'static str = "place.stream.segment"; type Record = SegmentRecord;}
impl Collection for SegmentRecord { const NSID: &'static str = "place.stream.segment"; type Record = SegmentRecord;}
impl<'a> LexiconSchema for Segment<'a> { fn nsid() -> &'static str { "place.stream.segment" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_place_stream_segment() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
impl<'a> LexiconSchema for SegmentView<'a> { fn nsid() -> &'static str { "place.stream.segment" } fn def_name() -> &'static str { "segmentView" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_place_stream_segment() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
impl<'a> LexiconSchema for Video<'a> { fn nsid() -> &'static str { "place.stream.segment" } fn def_name() -> &'static str { "video" } fn lexicon_doc() -> LexiconDoc<'static> { lexicon_doc_place_stream_segment() } fn validate(&self) -> Result<(), ConstraintError> { Ok(()) }}
pub mod audio_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Rate; type Channels; type Codec; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Rate = Unset; type Channels = Unset; type Codec = Unset; } ///State transition - sets the `rate` field to Set pub struct SetRate<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRate<S> {} impl<S: State> State for SetRate<S> { type Rate = Set<members::rate>; type Channels = S::Channels; type Codec = S::Codec; } ///State transition - sets the `channels` field to Set pub struct SetChannels<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetChannels<S> {} impl<S: State> State for SetChannels<S> { type Rate = S::Rate; type Channels = Set<members::channels>; type Codec = S::Codec; } ///State transition - sets the `codec` field to Set pub struct SetCodec<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCodec<S> {} impl<S: State> State for SetCodec<S> { type Rate = S::Rate; type Channels = S::Channels; type Codec = Set<members::codec>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `rate` field pub struct rate(()); ///Marker type for the `channels` field pub struct channels(()); ///Marker type for the `codec` field pub struct codec(()); }}
/// Builder for constructing an instance of this typepub struct AudioBuilder<'a, S: audio_state::State> { _state: PhantomData<fn() -> S>, _fields: (Option<i64>, Option<CowStr<'a>>, Option<i64>), _lifetime: PhantomData<&'a ()>,}
impl<'a> Audio<'a> { /// Create a new builder for this type pub fn new() -> AudioBuilder<'a, audio_state::Empty> { AudioBuilder::new() }}
impl<'a> AudioBuilder<'a, audio_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { AudioBuilder { _state: PhantomData, _fields: (None, None, None), _lifetime: PhantomData, } }}
impl<'a, S> AudioBuilder<'a, S>where S: audio_state::State, S::Channels: audio_state::IsUnset,{ /// Set the `channels` field (required) pub fn channels( mut self, value: impl Into<i64>, ) -> AudioBuilder<'a, audio_state::SetChannels<S>> { self._fields.0 = Option::Some(value.into()); AudioBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> AudioBuilder<'a, S>where S: audio_state::State, S::Codec: audio_state::IsUnset,{ /// Set the `codec` field (required) pub fn codec( mut self, value: impl Into<CowStr<'a>>, ) -> AudioBuilder<'a, audio_state::SetCodec<S>> { self._fields.1 = Option::Some(value.into()); AudioBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> AudioBuilder<'a, S>where S: audio_state::State, S::Rate: audio_state::IsUnset,{ /// Set the `rate` field (required) pub fn rate( mut self, value: impl Into<i64>, ) -> AudioBuilder<'a, audio_state::SetRate<S>> { self._fields.2 = Option::Some(value.into()); AudioBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> AudioBuilder<'a, S>where S: audio_state::State, S::Rate: audio_state::IsSet, S::Channels: audio_state::IsSet, S::Codec: audio_state::IsSet,{ /// Build the final struct pub fn build(self) -> Audio<'a> { Audio { channels: self._fields.0.unwrap(), codec: self._fields.1.unwrap(), rate: self._fields.2.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>, ) -> Audio<'a> { Audio { channels: self._fields.0.unwrap(), codec: self._fields.1.unwrap(), rate: self._fields.2.unwrap(), extra_data: Some(extra_data), } }}
fn lexicon_doc_place_stream_segment() -> LexiconDoc<'static> { #[allow(unused_imports)] use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType}; use jacquard_lexicon::lexicon::*; use alloc::collections::BTreeMap; LexiconDoc { lexicon: Lexicon::Lexicon1, id: CowStr::new_static("place.stream.segment"), defs: { let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("audio"), LexUserType::Object(LexObject { required: Some( vec![ SmolStr::new_static("codec"), SmolStr::new_static("rate"), SmolStr::new_static("channels") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("channels"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("codec"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("rate"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("framerate"), LexUserType::Object(LexObject { required: Some( vec![SmolStr::new_static("num"), SmolStr::new_static("den")], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("den"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("num"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("main"), LexUserType::Record(LexRecord { description: Some( CowStr::new_static( "Media file representing a segment of a livestream", ), ), key: Some(CowStr::new_static("tid")), record: LexRecordRecord::Object(LexObject { required: Some( vec![ SmolStr::new_static("id"), SmolStr::new_static("signingKey"), SmolStr::new_static("startTime"), SmolStr::new_static("creator") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("audio"), LexObjectProperty::Array(LexArray { items: LexArrayItem::Ref(LexRef { r#ref: CowStr::new_static("#audio"), ..Default::default() }), ..Default::default() }), ); map.insert( SmolStr::new_static("contentRights"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static( "place.stream.metadata.contentRights", ), ..Default::default() }), ); map.insert( SmolStr::new_static("contentWarnings"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static( "place.stream.metadata.contentWarnings", ), ..Default::default() }), ); map.insert( SmolStr::new_static("creator"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Did), ..Default::default() }), ); map.insert( SmolStr::new_static("distributionPolicy"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static( "place.stream.metadata.distributionPolicy", ), ..Default::default() }), ); map.insert( SmolStr::new_static("duration"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("id"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("Unique identifier for the segment"), ), ..Default::default() }), ); map.insert( SmolStr::new_static("signingKey"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static( "The DID of the signing key used for this segment", ), ), ..Default::default() }), ); map.insert( SmolStr::new_static("size"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("startTime"), LexObjectProperty::String(LexString { description: Some( CowStr::new_static("When this segment started"), ), format: Some(LexStringFormat::Datetime), ..Default::default() }), ); map.insert( SmolStr::new_static("video"), LexObjectProperty::Array(LexArray { items: LexArrayItem::Ref(LexRef { r#ref: CowStr::new_static("#video"), ..Default::default() }), ..Default::default() }), ); map }, ..Default::default() }), ..Default::default() }), ); map.insert( SmolStr::new_static("segmentView"), LexUserType::Object(LexObject { required: Some( vec![SmolStr::new_static("cid"), SmolStr::new_static("record")], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("cid"), LexObjectProperty::String(LexString { format: Some(LexStringFormat::Cid), ..Default::default() }), ); map.insert( SmolStr::new_static("record"), LexObjectProperty::Unknown(LexUnknown { ..Default::default() }), ); map }, ..Default::default() }), ); map.insert( SmolStr::new_static("video"), LexUserType::Object(LexObject { required: Some( vec![ SmolStr::new_static("codec"), SmolStr::new_static("width"), SmolStr::new_static("height") ], ), properties: { #[allow(unused_mut)] let mut map = BTreeMap::new(); map.insert( SmolStr::new_static("bframes"), LexObjectProperty::Boolean(LexBoolean { ..Default::default() }), ); map.insert( SmolStr::new_static("codec"), LexObjectProperty::String(LexString { ..Default::default() }), ); map.insert( SmolStr::new_static("framerate"), LexObjectProperty::Ref(LexRef { r#ref: CowStr::new_static("#framerate"), ..Default::default() }), ); map.insert( SmolStr::new_static("height"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map.insert( SmolStr::new_static("width"), LexObjectProperty::Integer(LexInteger { ..Default::default() }), ); map }, ..Default::default() }), ); map }, ..Default::default() }}
pub mod framerate_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Num; type Den; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Num = Unset; type Den = Unset; } ///State transition - sets the `num` field to Set pub struct SetNum<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetNum<S> {} impl<S: State> State for SetNum<S> { type Num = Set<members::num>; type Den = S::Den; } ///State transition - sets the `den` field to Set pub struct SetDen<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetDen<S> {} impl<S: State> State for SetDen<S> { type Num = S::Num; type Den = Set<members::den>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `num` field pub struct num(()); ///Marker type for the `den` field pub struct den(()); }}
/// Builder for constructing an instance of this typepub struct FramerateBuilder<'a, S: framerate_state::State> { _state: PhantomData<fn() -> S>, _fields: (Option<i64>, Option<i64>), _lifetime: PhantomData<&'a ()>,}
impl<'a> Framerate<'a> { /// Create a new builder for this type pub fn new() -> FramerateBuilder<'a, framerate_state::Empty> { FramerateBuilder::new() }}
impl<'a> FramerateBuilder<'a, framerate_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { FramerateBuilder { _state: PhantomData, _fields: (None, None), _lifetime: PhantomData, } }}
impl<'a, S> FramerateBuilder<'a, S>where S: framerate_state::State, S::Den: framerate_state::IsUnset,{ /// Set the `den` field (required) pub fn den( mut self, value: impl Into<i64>, ) -> FramerateBuilder<'a, framerate_state::SetDen<S>> { self._fields.0 = Option::Some(value.into()); FramerateBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> FramerateBuilder<'a, S>where S: framerate_state::State, S::Num: framerate_state::IsUnset,{ /// Set the `num` field (required) pub fn num( mut self, value: impl Into<i64>, ) -> FramerateBuilder<'a, framerate_state::SetNum<S>> { self._fields.1 = Option::Some(value.into()); FramerateBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> FramerateBuilder<'a, S>where S: framerate_state::State, S::Num: framerate_state::IsSet, S::Den: framerate_state::IsSet,{ /// Build the final struct pub fn build(self) -> Framerate<'a> { Framerate { den: self._fields.0.unwrap(), num: self._fields.1.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>, ) -> Framerate<'a> { Framerate { den: self._fields.0.unwrap(), num: self._fields.1.unwrap(), extra_data: Some(extra_data), } }}
pub mod segment_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type SigningKey; type StartTime; type Id; type Creator; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type SigningKey = Unset; type StartTime = Unset; type Id = Unset; type Creator = Unset; } ///State transition - sets the `signing_key` field to Set pub struct SetSigningKey<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetSigningKey<S> {} impl<S: State> State for SetSigningKey<S> { type SigningKey = Set<members::signing_key>; type StartTime = S::StartTime; type Id = S::Id; type Creator = S::Creator; } ///State transition - sets the `start_time` field to Set pub struct SetStartTime<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetStartTime<S> {} impl<S: State> State for SetStartTime<S> { type SigningKey = S::SigningKey; type StartTime = Set<members::start_time>; type Id = S::Id; type Creator = S::Creator; } ///State transition - sets the `id` field to Set pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetId<S> {} impl<S: State> State for SetId<S> { type SigningKey = S::SigningKey; type StartTime = S::StartTime; type Id = Set<members::id>; type Creator = S::Creator; } ///State transition - sets the `creator` field to Set pub struct SetCreator<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCreator<S> {} impl<S: State> State for SetCreator<S> { type SigningKey = S::SigningKey; type StartTime = S::StartTime; type Id = S::Id; type Creator = Set<members::creator>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `signing_key` field pub struct signing_key(()); ///Marker type for the `start_time` field pub struct start_time(()); ///Marker type for the `id` field pub struct id(()); ///Marker type for the `creator` field pub struct creator(()); }}
/// Builder for constructing an instance of this typepub struct SegmentBuilder<'a, S: segment_state::State> { _state: PhantomData<fn() -> S>, _fields: ( Option<Vec<segment::Audio<'a>>>, Option<ContentRights<'a>>, Option<ContentWarnings<'a>>, Option<Did<'a>>, Option<DistributionPolicy<'a>>, Option<i64>, Option<CowStr<'a>>, Option<CowStr<'a>>, Option<i64>, Option<Datetime>, Option<Vec<segment::Video<'a>>>, ), _lifetime: PhantomData<&'a ()>,}
impl<'a> Segment<'a> { /// Create a new builder for this type pub fn new() -> SegmentBuilder<'a, segment_state::Empty> { SegmentBuilder::new() }}
impl<'a> SegmentBuilder<'a, segment_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { SegmentBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None, None, None, None, None, None), _lifetime: PhantomData, } }}
impl<'a, S: segment_state::State> SegmentBuilder<'a, S> { /// Set the `audio` field (optional) pub fn audio(mut self, value: impl Into<Option<Vec<segment::Audio<'a>>>>) -> Self { self._fields.0 = value.into(); self } /// Set the `audio` field to an Option value (optional) pub fn maybe_audio(mut self, value: Option<Vec<segment::Audio<'a>>>) -> Self { self._fields.0 = value; self }}
impl<'a, S: segment_state::State> SegmentBuilder<'a, S> { /// Set the `contentRights` field (optional) pub fn content_rights( mut self, value: impl Into<Option<ContentRights<'a>>>, ) -> Self { self._fields.1 = value.into(); self } /// Set the `contentRights` field to an Option value (optional) pub fn maybe_content_rights(mut self, value: Option<ContentRights<'a>>) -> Self { self._fields.1 = value; self }}
impl<'a, S: segment_state::State> SegmentBuilder<'a, S> { /// Set the `contentWarnings` field (optional) pub fn content_warnings( mut self, value: impl Into<Option<ContentWarnings<'a>>>, ) -> Self { self._fields.2 = value.into(); self } /// Set the `contentWarnings` field to an Option value (optional) pub fn maybe_content_warnings(mut self, value: Option<ContentWarnings<'a>>) -> Self { self._fields.2 = value; self }}
impl<'a, S> SegmentBuilder<'a, S>where S: segment_state::State, S::Creator: segment_state::IsUnset,{ /// Set the `creator` field (required) pub fn creator( mut self, value: impl Into<Did<'a>>, ) -> SegmentBuilder<'a, segment_state::SetCreator<S>> { self._fields.3 = Option::Some(value.into()); SegmentBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S: segment_state::State> SegmentBuilder<'a, S> { /// Set the `distributionPolicy` field (optional) pub fn distribution_policy( mut self, value: impl Into<Option<DistributionPolicy<'a>>>, ) -> Self { self._fields.4 = value.into(); self } /// Set the `distributionPolicy` field to an Option value (optional) pub fn maybe_distribution_policy( mut self, value: Option<DistributionPolicy<'a>>, ) -> Self { self._fields.4 = value; self }}
impl<'a, S: segment_state::State> SegmentBuilder<'a, S> { /// Set the `duration` field (optional) pub fn duration(mut self, value: impl Into<Option<i64>>) -> Self { self._fields.5 = value.into(); self } /// Set the `duration` field to an Option value (optional) pub fn maybe_duration(mut self, value: Option<i64>) -> Self { self._fields.5 = value; self }}
impl<'a, S> SegmentBuilder<'a, S>where S: segment_state::State, S::Id: segment_state::IsUnset,{ /// Set the `id` field (required) pub fn id( mut self, value: impl Into<CowStr<'a>>, ) -> SegmentBuilder<'a, segment_state::SetId<S>> { self._fields.6 = Option::Some(value.into()); SegmentBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> SegmentBuilder<'a, S>where S: segment_state::State, S::SigningKey: segment_state::IsUnset,{ /// Set the `signingKey` field (required) pub fn signing_key( mut self, value: impl Into<CowStr<'a>>, ) -> SegmentBuilder<'a, segment_state::SetSigningKey<S>> { self._fields.7 = Option::Some(value.into()); SegmentBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S: segment_state::State> SegmentBuilder<'a, S> { /// Set the `size` field (optional) pub fn size(mut self, value: impl Into<Option<i64>>) -> Self { self._fields.8 = value.into(); self } /// Set the `size` field to an Option value (optional) pub fn maybe_size(mut self, value: Option<i64>) -> Self { self._fields.8 = value; self }}
impl<'a, S> SegmentBuilder<'a, S>where S: segment_state::State, S::StartTime: segment_state::IsUnset,{ /// Set the `startTime` field (required) pub fn start_time( mut self, value: impl Into<Datetime>, ) -> SegmentBuilder<'a, segment_state::SetStartTime<S>> { self._fields.9 = Option::Some(value.into()); SegmentBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S: segment_state::State> SegmentBuilder<'a, S> { /// Set the `video` field (optional) pub fn video(mut self, value: impl Into<Option<Vec<segment::Video<'a>>>>) -> Self { self._fields.10 = value.into(); self } /// Set the `video` field to an Option value (optional) pub fn maybe_video(mut self, value: Option<Vec<segment::Video<'a>>>) -> Self { self._fields.10 = value; self }}
impl<'a, S> SegmentBuilder<'a, S>where S: segment_state::State, S::SigningKey: segment_state::IsSet, S::StartTime: segment_state::IsSet, S::Id: segment_state::IsSet, S::Creator: segment_state::IsSet,{ /// Build the final struct pub fn build(self) -> Segment<'a> { Segment { audio: self._fields.0, content_rights: self._fields.1, content_warnings: self._fields.2, creator: self._fields.3.unwrap(), distribution_policy: self._fields.4, duration: self._fields.5, id: self._fields.6.unwrap(), signing_key: self._fields.7.unwrap(), size: self._fields.8, start_time: self._fields.9.unwrap(), video: self._fields.10, extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>, ) -> Segment<'a> { Segment { audio: self._fields.0, content_rights: self._fields.1, content_warnings: self._fields.2, creator: self._fields.3.unwrap(), distribution_policy: self._fields.4, duration: self._fields.5, id: self._fields.6.unwrap(), signing_key: self._fields.7.unwrap(), size: self._fields.8, start_time: self._fields.9.unwrap(), video: self._fields.10, extra_data: Some(extra_data), } }}
pub mod segment_view_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Record; type Cid; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Record = Unset; type Cid = Unset; } ///State transition - sets the `record` field to Set pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetRecord<S> {} impl<S: State> State for SetRecord<S> { type Record = Set<members::record>; type Cid = S::Cid; } ///State transition - sets the `cid` field to Set pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCid<S> {} impl<S: State> State for SetCid<S> { type Record = S::Record; type Cid = Set<members::cid>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `record` field pub struct record(()); ///Marker type for the `cid` field pub struct cid(()); }}
/// Builder for constructing an instance of this typepub struct SegmentViewBuilder<'a, S: segment_view_state::State> { _state: PhantomData<fn() -> S>, _fields: (Option<Cid<'a>>, Option<Data<'a>>), _lifetime: PhantomData<&'a ()>,}
impl<'a> SegmentView<'a> { /// Create a new builder for this type pub fn new() -> SegmentViewBuilder<'a, segment_view_state::Empty> { SegmentViewBuilder::new() }}
impl<'a> SegmentViewBuilder<'a, segment_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { SegmentViewBuilder { _state: PhantomData, _fields: (None, None), _lifetime: PhantomData, } }}
impl<'a, S> SegmentViewBuilder<'a, S>where S: segment_view_state::State, S::Cid: segment_view_state::IsUnset,{ /// Set the `cid` field (required) pub fn cid( mut self, value: impl Into<Cid<'a>>, ) -> SegmentViewBuilder<'a, segment_view_state::SetCid<S>> { self._fields.0 = Option::Some(value.into()); SegmentViewBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> SegmentViewBuilder<'a, S>where S: segment_view_state::State, S::Record: segment_view_state::IsUnset,{ /// Set the `record` field (required) pub fn record( mut self, value: impl Into<Data<'a>>, ) -> SegmentViewBuilder<'a, segment_view_state::SetRecord<S>> { self._fields.1 = Option::Some(value.into()); SegmentViewBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> SegmentViewBuilder<'a, S>where S: segment_view_state::State, S::Record: segment_view_state::IsSet, S::Cid: segment_view_state::IsSet,{ /// Build the final struct pub fn build(self) -> SegmentView<'a> { SegmentView { cid: self._fields.0.unwrap(), record: self._fields.1.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>, ) -> SegmentView<'a> { SegmentView { cid: self._fields.0.unwrap(), record: self._fields.1.unwrap(), extra_data: Some(extra_data), } }}
pub mod video_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Width; type Codec; type Height; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Width = Unset; type Codec = Unset; type Height = Unset; } ///State transition - sets the `width` field to Set pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetWidth<S> {} impl<S: State> State for SetWidth<S> { type Width = Set<members::width>; type Codec = S::Codec; type Height = S::Height; } ///State transition - sets the `codec` field to Set pub struct SetCodec<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetCodec<S> {} impl<S: State> State for SetCodec<S> { type Width = S::Width; type Codec = Set<members::codec>; type Height = S::Height; } ///State transition - sets the `height` field to Set pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>); impl<S: State> sealed::Sealed for SetHeight<S> {} impl<S: State> State for SetHeight<S> { type Width = S::Width; type Codec = S::Codec; type Height = Set<members::height>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `width` field pub struct width(()); ///Marker type for the `codec` field pub struct codec(()); ///Marker type for the `height` field pub struct height(()); }}
/// Builder for constructing an instance of this typepub struct VideoBuilder<'a, S: video_state::State> { _state: PhantomData<fn() -> S>, _fields: ( Option<bool>, Option<CowStr<'a>>, Option<segment::Framerate<'a>>, Option<i64>, Option<i64>, ), _lifetime: PhantomData<&'a ()>,}
impl<'a> Video<'a> { /// Create a new builder for this type pub fn new() -> VideoBuilder<'a, video_state::Empty> { VideoBuilder::new() }}
impl<'a> VideoBuilder<'a, video_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { VideoBuilder { _state: PhantomData, _fields: (None, None, None, None, None), _lifetime: PhantomData, } }}
impl<'a, S: video_state::State> VideoBuilder<'a, S> { /// Set the `bframes` field (optional) pub fn bframes(mut self, value: impl Into<Option<bool>>) -> Self { self._fields.0 = value.into(); self } /// Set the `bframes` field to an Option value (optional) pub fn maybe_bframes(mut self, value: Option<bool>) -> Self { self._fields.0 = value; self }}
impl<'a, S> VideoBuilder<'a, S>where S: video_state::State, S::Codec: video_state::IsUnset,{ /// Set the `codec` field (required) pub fn codec( mut self, value: impl Into<CowStr<'a>>, ) -> VideoBuilder<'a, video_state::SetCodec<S>> { self._fields.1 = Option::Some(value.into()); VideoBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S: video_state::State> VideoBuilder<'a, S> { /// Set the `framerate` field (optional) pub fn framerate( mut self, value: impl Into<Option<segment::Framerate<'a>>>, ) -> Self { self._fields.2 = value.into(); self } /// Set the `framerate` field to an Option value (optional) pub fn maybe_framerate(mut self, value: Option<segment::Framerate<'a>>) -> Self { self._fields.2 = value; self }}
impl<'a, S> VideoBuilder<'a, S>where S: video_state::State, S::Height: video_state::IsUnset,{ /// Set the `height` field (required) pub fn height( mut self, value: impl Into<i64>, ) -> VideoBuilder<'a, video_state::SetHeight<S>> { self._fields.3 = Option::Some(value.into()); VideoBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> VideoBuilder<'a, S>where S: video_state::State, S::Width: video_state::IsUnset,{ /// Set the `width` field (required) pub fn width( mut self, value: impl Into<i64>, ) -> VideoBuilder<'a, video_state::SetWidth<S>> { self._fields.4 = Option::Some(value.into()); VideoBuilder { _state: PhantomData, _fields: self._fields, _lifetime: PhantomData, } }}
impl<'a, S> VideoBuilder<'a, S>where S: video_state::State, S::Width: video_state::IsSet, S::Codec: video_state::IsSet, S::Height: video_state::IsSet,{ /// Build the final struct pub fn build(self) -> Video<'a> { Video { bframes: self._fields.0, codec: self._fields.1.unwrap(), framerate: self._fields.2, height: self._fields.3.unwrap(), width: self._fields.4.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>, ) -> Video<'a> { Video { bframes: self._fields.0, codec: self._fields.1.unwrap(), framerate: self._fields.2, height: self._fields.3.unwrap(), width: self._fields.4.unwrap(), extra_data: Some(extra_data), } }}