1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14
15#[allow(unused_imports)]
16use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
17use jacquard_common::types::collection::{Collection, RecordError};
18use jacquard_common::types::string::{Did, AtUri, Cid};
19use jacquard_common::types::uri::{RecordUri, UriError};
20use jacquard_common::xrpc::XrpcResp;
21use jacquard_derive::{IntoStatic, lexicon};
22use jacquard_lexicon::lexicon::LexiconDoc;
23use jacquard_lexicon::schema::LexiconSchema;
24
25#[allow(unused_imports)]
26use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
27use serde::{Serialize, Deserialize};
28use crate::sh_tangled::git::ref_update;
29
30#[lexicon]
31#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
32#[serde(rename_all = "camelCase")]
33pub struct CommitCountBreakdown<'a> {
34 #[serde(skip_serializing_if = "Option::is_none")]
35 #[serde(borrow)]
36 pub by_email: Option<Vec<ref_update::IndividualEmailCommitCount<'a>>>,
37}
38
39
40#[lexicon]
41#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
42#[serde(rename_all = "camelCase")]
43pub struct IndividualEmailCommitCount<'a> {
44 pub count: i64,
45 #[serde(borrow)]
46 pub email: CowStr<'a>,
47}
48
49
50#[lexicon]
51#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
52#[serde(rename_all = "camelCase")]
53pub struct IndividualLanguageSize<'a> {
54 #[serde(borrow)]
55 pub lang: CowStr<'a>,
56 pub size: i64,
57}
58
59
60#[lexicon]
61#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
62#[serde(rename_all = "camelCase")]
63pub struct LangBreakdown<'a> {
64 #[serde(skip_serializing_if = "Option::is_none")]
65 #[serde(borrow)]
66 pub inputs: Option<Vec<ref_update::IndividualLanguageSize<'a>>>,
67}
68
69#[lexicon]
72#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
73#[serde(rename_all = "camelCase", rename = "sh.tangled.git.refUpdate", tag = "$type")]
74pub struct RefUpdate<'a> {
75 #[serde(borrow)]
77 pub committer_did: Did<'a>,
78 #[serde(borrow)]
79 pub meta: ref_update::Meta<'a>,
80 #[serde(borrow)]
82 pub new_sha: CowStr<'a>,
83 #[serde(borrow)]
85 pub old_sha: CowStr<'a>,
86 #[serde(borrow)]
88 pub r#ref: CowStr<'a>,
89 #[serde(borrow)]
91 pub repo_did: Did<'a>,
92 #[serde(borrow)]
94 pub repo_name: CowStr<'a>,
95}
96
97#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
100#[serde(rename_all = "camelCase")]
101pub struct RefUpdateGetRecordOutput<'a> {
102 #[serde(skip_serializing_if = "Option::is_none")]
103 #[serde(borrow)]
104 pub cid: Option<Cid<'a>>,
105 #[serde(borrow)]
106 pub uri: AtUri<'a>,
107 #[serde(borrow)]
108 pub value: RefUpdate<'a>,
109}
110
111
112#[lexicon]
113#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
114#[serde(rename_all = "camelCase")]
115pub struct Meta<'a> {
116 #[serde(borrow)]
117 pub commit_count: ref_update::CommitCountBreakdown<'a>,
118 #[serde(default = "_default_meta_is_default_ref")]
120 pub is_default_ref: bool,
121 #[serde(skip_serializing_if = "Option::is_none")]
122 #[serde(borrow)]
123 pub lang_breakdown: Option<ref_update::LangBreakdown<'a>>,
124}
125
126impl<'a> RefUpdate<'a> {
127 pub fn uri(
128 uri: impl Into<CowStr<'a>>,
129 ) -> Result<RecordUri<'a, RefUpdateRecord>, UriError> {
130 RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
131 }
132}
133
134impl<'a> LexiconSchema for CommitCountBreakdown<'a> {
135 fn nsid() -> &'static str {
136 "sh.tangled.git.refUpdate"
137 }
138 fn def_name() -> &'static str {
139 "commitCountBreakdown"
140 }
141 fn lexicon_doc() -> LexiconDoc<'static> {
142 lexicon_doc_sh_tangled_git_refUpdate()
143 }
144 fn validate(&self) -> Result<(), ConstraintError> {
145 Ok(())
146 }
147}
148
149impl<'a> LexiconSchema for IndividualEmailCommitCount<'a> {
150 fn nsid() -> &'static str {
151 "sh.tangled.git.refUpdate"
152 }
153 fn def_name() -> &'static str {
154 "individualEmailCommitCount"
155 }
156 fn lexicon_doc() -> LexiconDoc<'static> {
157 lexicon_doc_sh_tangled_git_refUpdate()
158 }
159 fn validate(&self) -> Result<(), ConstraintError> {
160 Ok(())
161 }
162}
163
164impl<'a> LexiconSchema for IndividualLanguageSize<'a> {
165 fn nsid() -> &'static str {
166 "sh.tangled.git.refUpdate"
167 }
168 fn def_name() -> &'static str {
169 "individualLanguageSize"
170 }
171 fn lexicon_doc() -> LexiconDoc<'static> {
172 lexicon_doc_sh_tangled_git_refUpdate()
173 }
174 fn validate(&self) -> Result<(), ConstraintError> {
175 Ok(())
176 }
177}
178
179impl<'a> LexiconSchema for LangBreakdown<'a> {
180 fn nsid() -> &'static str {
181 "sh.tangled.git.refUpdate"
182 }
183 fn def_name() -> &'static str {
184 "langBreakdown"
185 }
186 fn lexicon_doc() -> LexiconDoc<'static> {
187 lexicon_doc_sh_tangled_git_refUpdate()
188 }
189 fn validate(&self) -> Result<(), ConstraintError> {
190 Ok(())
191 }
192}
193
194#[derive(Debug, Serialize, Deserialize)]
197pub struct RefUpdateRecord;
198impl XrpcResp for RefUpdateRecord {
199 const NSID: &'static str = "sh.tangled.git.refUpdate";
200 const ENCODING: &'static str = "application/json";
201 type Output<'de> = RefUpdateGetRecordOutput<'de>;
202 type Err<'de> = RecordError<'de>;
203}
204
205impl From<RefUpdateGetRecordOutput<'_>> for RefUpdate<'_> {
206 fn from(output: RefUpdateGetRecordOutput<'_>) -> Self {
207 use jacquard_common::IntoStatic;
208 output.value.into_static()
209 }
210}
211
212impl Collection for RefUpdate<'_> {
213 const NSID: &'static str = "sh.tangled.git.refUpdate";
214 type Record = RefUpdateRecord;
215}
216
217impl Collection for RefUpdateRecord {
218 const NSID: &'static str = "sh.tangled.git.refUpdate";
219 type Record = RefUpdateRecord;
220}
221
222impl<'a> LexiconSchema for RefUpdate<'a> {
223 fn nsid() -> &'static str {
224 "sh.tangled.git.refUpdate"
225 }
226 fn def_name() -> &'static str {
227 "main"
228 }
229 fn lexicon_doc() -> LexiconDoc<'static> {
230 lexicon_doc_sh_tangled_git_refUpdate()
231 }
232 fn validate(&self) -> Result<(), ConstraintError> {
233 {
234 let value = &self.new_sha;
235 #[allow(unused_comparisons)]
236 if <str>::len(value.as_ref()) > 40usize {
237 return Err(ConstraintError::MaxLength {
238 path: ValidationPath::from_field("new_sha"),
239 max: 40usize,
240 actual: <str>::len(value.as_ref()),
241 });
242 }
243 }
244 {
245 let value = &self.new_sha;
246 #[allow(unused_comparisons)]
247 if <str>::len(value.as_ref()) < 40usize {
248 return Err(ConstraintError::MinLength {
249 path: ValidationPath::from_field("new_sha"),
250 min: 40usize,
251 actual: <str>::len(value.as_ref()),
252 });
253 }
254 }
255 {
256 let value = &self.old_sha;
257 #[allow(unused_comparisons)]
258 if <str>::len(value.as_ref()) > 40usize {
259 return Err(ConstraintError::MaxLength {
260 path: ValidationPath::from_field("old_sha"),
261 max: 40usize,
262 actual: <str>::len(value.as_ref()),
263 });
264 }
265 }
266 {
267 let value = &self.old_sha;
268 #[allow(unused_comparisons)]
269 if <str>::len(value.as_ref()) < 40usize {
270 return Err(ConstraintError::MinLength {
271 path: ValidationPath::from_field("old_sha"),
272 min: 40usize,
273 actual: <str>::len(value.as_ref()),
274 });
275 }
276 }
277 {
278 let value = &self.r#ref;
279 #[allow(unused_comparisons)]
280 if <str>::len(value.as_ref()) > 2560usize {
281 return Err(ConstraintError::MaxLength {
282 path: ValidationPath::from_field("ref"),
283 max: 2560usize,
284 actual: <str>::len(value.as_ref()),
285 });
286 }
287 }
288 {
289 let value = &self.r#ref;
290 {
291 let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
292 if count > 256usize {
293 return Err(ConstraintError::MaxGraphemes {
294 path: ValidationPath::from_field("ref"),
295 max: 256usize,
296 actual: count,
297 });
298 }
299 }
300 }
301 Ok(())
302 }
303}
304
305impl<'a> LexiconSchema for Meta<'a> {
306 fn nsid() -> &'static str {
307 "sh.tangled.git.refUpdate"
308 }
309 fn def_name() -> &'static str {
310 "meta"
311 }
312 fn lexicon_doc() -> LexiconDoc<'static> {
313 lexicon_doc_sh_tangled_git_refUpdate()
314 }
315 fn validate(&self) -> Result<(), ConstraintError> {
316 Ok(())
317 }
318}
319
320fn lexicon_doc_sh_tangled_git_refUpdate() -> LexiconDoc<'static> {
321 #[allow(unused_imports)]
322 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
323 use jacquard_lexicon::lexicon::*;
324 use alloc::collections::BTreeMap;
325 LexiconDoc {
326 lexicon: Lexicon::Lexicon1,
327 id: CowStr::new_static("sh.tangled.git.refUpdate"),
328 defs: {
329 let mut map = BTreeMap::new();
330 map.insert(
331 SmolStr::new_static("commitCountBreakdown"),
332 LexUserType::Object(LexObject {
333 required: Some(vec![]),
334 properties: {
335 #[allow(unused_mut)]
336 let mut map = BTreeMap::new();
337 map.insert(
338 SmolStr::new_static("byEmail"),
339 LexObjectProperty::Array(LexArray {
340 items: LexArrayItem::Ref(LexRef {
341 r#ref: CowStr::new_static("#individualEmailCommitCount"),
342 ..Default::default()
343 }),
344 ..Default::default()
345 }),
346 );
347 map
348 },
349 ..Default::default()
350 }),
351 );
352 map.insert(
353 SmolStr::new_static("individualEmailCommitCount"),
354 LexUserType::Object(LexObject {
355 required: Some(
356 vec![SmolStr::new_static("email"), SmolStr::new_static("count")],
357 ),
358 properties: {
359 #[allow(unused_mut)]
360 let mut map = BTreeMap::new();
361 map.insert(
362 SmolStr::new_static("count"),
363 LexObjectProperty::Integer(LexInteger {
364 ..Default::default()
365 }),
366 );
367 map.insert(
368 SmolStr::new_static("email"),
369 LexObjectProperty::String(LexString { ..Default::default() }),
370 );
371 map
372 },
373 ..Default::default()
374 }),
375 );
376 map.insert(
377 SmolStr::new_static("individualLanguageSize"),
378 LexUserType::Object(LexObject {
379 required: Some(
380 vec![SmolStr::new_static("lang"), SmolStr::new_static("size")],
381 ),
382 properties: {
383 #[allow(unused_mut)]
384 let mut map = BTreeMap::new();
385 map.insert(
386 SmolStr::new_static("lang"),
387 LexObjectProperty::String(LexString { ..Default::default() }),
388 );
389 map.insert(
390 SmolStr::new_static("size"),
391 LexObjectProperty::Integer(LexInteger {
392 ..Default::default()
393 }),
394 );
395 map
396 },
397 ..Default::default()
398 }),
399 );
400 map.insert(
401 SmolStr::new_static("langBreakdown"),
402 LexUserType::Object(LexObject {
403 properties: {
404 #[allow(unused_mut)]
405 let mut map = BTreeMap::new();
406 map.insert(
407 SmolStr::new_static("inputs"),
408 LexObjectProperty::Array(LexArray {
409 items: LexArrayItem::Ref(LexRef {
410 r#ref: CowStr::new_static("#individualLanguageSize"),
411 ..Default::default()
412 }),
413 ..Default::default()
414 }),
415 );
416 map
417 },
418 ..Default::default()
419 }),
420 );
421 map.insert(
422 SmolStr::new_static("main"),
423 LexUserType::Record(LexRecord {
424 description: Some(
425 CowStr::new_static(
426 "An update to a git repository, emitted by knots.",
427 ),
428 ),
429 key: Some(CowStr::new_static("tid")),
430 record: LexRecordRecord::Object(LexObject {
431 required: Some(
432 vec![
433 SmolStr::new_static("ref"),
434 SmolStr::new_static("committerDid"),
435 SmolStr::new_static("repoDid"),
436 SmolStr::new_static("repoName"),
437 SmolStr::new_static("oldSha"),
438 SmolStr::new_static("newSha"), SmolStr::new_static("meta")
439 ],
440 ),
441 properties: {
442 #[allow(unused_mut)]
443 let mut map = BTreeMap::new();
444 map.insert(
445 SmolStr::new_static("committerDid"),
446 LexObjectProperty::String(LexString {
447 description: Some(
448 CowStr::new_static("did of the user that pushed this ref"),
449 ),
450 format: Some(LexStringFormat::Did),
451 ..Default::default()
452 }),
453 );
454 map.insert(
455 SmolStr::new_static("meta"),
456 LexObjectProperty::Ref(LexRef {
457 r#ref: CowStr::new_static("#meta"),
458 ..Default::default()
459 }),
460 );
461 map.insert(
462 SmolStr::new_static("newSha"),
463 LexObjectProperty::String(LexString {
464 description: Some(
465 CowStr::new_static("new SHA of this ref"),
466 ),
467 min_length: Some(40usize),
468 max_length: Some(40usize),
469 ..Default::default()
470 }),
471 );
472 map.insert(
473 SmolStr::new_static("oldSha"),
474 LexObjectProperty::String(LexString {
475 description: Some(
476 CowStr::new_static("old SHA of this ref"),
477 ),
478 min_length: Some(40usize),
479 max_length: Some(40usize),
480 ..Default::default()
481 }),
482 );
483 map.insert(
484 SmolStr::new_static("ref"),
485 LexObjectProperty::String(LexString {
486 description: Some(CowStr::new_static("Ref being updated")),
487 max_length: Some(2560usize),
488 max_graphemes: Some(256usize),
489 ..Default::default()
490 }),
491 );
492 map.insert(
493 SmolStr::new_static("repoDid"),
494 LexObjectProperty::String(LexString {
495 description: Some(
496 CowStr::new_static("did of the owner of the repo"),
497 ),
498 format: Some(LexStringFormat::Did),
499 ..Default::default()
500 }),
501 );
502 map.insert(
503 SmolStr::new_static("repoName"),
504 LexObjectProperty::String(LexString {
505 description: Some(CowStr::new_static("name of the repo")),
506 ..Default::default()
507 }),
508 );
509 map
510 },
511 ..Default::default()
512 }),
513 ..Default::default()
514 }),
515 );
516 map.insert(
517 SmolStr::new_static("meta"),
518 LexUserType::Object(LexObject {
519 required: Some(
520 vec![
521 SmolStr::new_static("isDefaultRef"),
522 SmolStr::new_static("commitCount")
523 ],
524 ),
525 properties: {
526 #[allow(unused_mut)]
527 let mut map = BTreeMap::new();
528 map.insert(
529 SmolStr::new_static("commitCount"),
530 LexObjectProperty::Ref(LexRef {
531 r#ref: CowStr::new_static("#commitCountBreakdown"),
532 ..Default::default()
533 }),
534 );
535 map.insert(
536 SmolStr::new_static("isDefaultRef"),
537 LexObjectProperty::Boolean(LexBoolean {
538 ..Default::default()
539 }),
540 );
541 map.insert(
542 SmolStr::new_static("langBreakdown"),
543 LexObjectProperty::Ref(LexRef {
544 r#ref: CowStr::new_static("#langBreakdown"),
545 ..Default::default()
546 }),
547 );
548 map
549 },
550 ..Default::default()
551 }),
552 );
553 map
554 },
555 ..Default::default()
556 }
557}
558
559pub mod individual_email_commit_count_state {
560
561 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
562 #[allow(unused)]
563 use ::core::marker::PhantomData;
564 mod sealed {
565 pub trait Sealed {}
566 }
567 pub trait State: sealed::Sealed {
569 type Email;
570 type Count;
571 }
572 pub struct Empty(());
574 impl sealed::Sealed for Empty {}
575 impl State for Empty {
576 type Email = Unset;
577 type Count = Unset;
578 }
579 pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>);
581 impl<S: State> sealed::Sealed for SetEmail<S> {}
582 impl<S: State> State for SetEmail<S> {
583 type Email = Set<members::email>;
584 type Count = S::Count;
585 }
586 pub struct SetCount<S: State = Empty>(PhantomData<fn() -> S>);
588 impl<S: State> sealed::Sealed for SetCount<S> {}
589 impl<S: State> State for SetCount<S> {
590 type Email = S::Email;
591 type Count = Set<members::count>;
592 }
593 #[allow(non_camel_case_types)]
595 pub mod members {
596 pub struct email(());
598 pub struct count(());
600 }
601}
602
603pub struct IndividualEmailCommitCountBuilder<
605 'a,
606 S: individual_email_commit_count_state::State,
607> {
608 _state: PhantomData<fn() -> S>,
609 _fields: (Option<i64>, Option<CowStr<'a>>),
610 _lifetime: PhantomData<&'a ()>,
611}
612
613impl<'a> IndividualEmailCommitCount<'a> {
614 pub fn new() -> IndividualEmailCommitCountBuilder<
616 'a,
617 individual_email_commit_count_state::Empty,
618 > {
619 IndividualEmailCommitCountBuilder::new()
620 }
621}
622
623impl<
624 'a,
625> IndividualEmailCommitCountBuilder<'a, individual_email_commit_count_state::Empty> {
626 pub fn new() -> Self {
628 IndividualEmailCommitCountBuilder {
629 _state: PhantomData,
630 _fields: (None, None),
631 _lifetime: PhantomData,
632 }
633 }
634}
635
636impl<'a, S> IndividualEmailCommitCountBuilder<'a, S>
637where
638 S: individual_email_commit_count_state::State,
639 S::Count: individual_email_commit_count_state::IsUnset,
640{
641 pub fn count(
643 mut self,
644 value: impl Into<i64>,
645 ) -> IndividualEmailCommitCountBuilder<
646 'a,
647 individual_email_commit_count_state::SetCount<S>,
648 > {
649 self._fields.0 = Option::Some(value.into());
650 IndividualEmailCommitCountBuilder {
651 _state: PhantomData,
652 _fields: self._fields,
653 _lifetime: PhantomData,
654 }
655 }
656}
657
658impl<'a, S> IndividualEmailCommitCountBuilder<'a, S>
659where
660 S: individual_email_commit_count_state::State,
661 S::Email: individual_email_commit_count_state::IsUnset,
662{
663 pub fn email(
665 mut self,
666 value: impl Into<CowStr<'a>>,
667 ) -> IndividualEmailCommitCountBuilder<
668 'a,
669 individual_email_commit_count_state::SetEmail<S>,
670 > {
671 self._fields.1 = Option::Some(value.into());
672 IndividualEmailCommitCountBuilder {
673 _state: PhantomData,
674 _fields: self._fields,
675 _lifetime: PhantomData,
676 }
677 }
678}
679
680impl<'a, S> IndividualEmailCommitCountBuilder<'a, S>
681where
682 S: individual_email_commit_count_state::State,
683 S::Email: individual_email_commit_count_state::IsSet,
684 S::Count: individual_email_commit_count_state::IsSet,
685{
686 pub fn build(self) -> IndividualEmailCommitCount<'a> {
688 IndividualEmailCommitCount {
689 count: self._fields.0.unwrap(),
690 email: self._fields.1.unwrap(),
691 extra_data: Default::default(),
692 }
693 }
694 pub fn build_with_data(
696 self,
697 extra_data: BTreeMap<
698 jacquard_common::deps::smol_str::SmolStr,
699 jacquard_common::types::value::Data<'a>,
700 >,
701 ) -> IndividualEmailCommitCount<'a> {
702 IndividualEmailCommitCount {
703 count: self._fields.0.unwrap(),
704 email: self._fields.1.unwrap(),
705 extra_data: Some(extra_data),
706 }
707 }
708}
709
710pub mod individual_language_size_state {
711
712 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
713 #[allow(unused)]
714 use ::core::marker::PhantomData;
715 mod sealed {
716 pub trait Sealed {}
717 }
718 pub trait State: sealed::Sealed {
720 type Size;
721 type Lang;
722 }
723 pub struct Empty(());
725 impl sealed::Sealed for Empty {}
726 impl State for Empty {
727 type Size = Unset;
728 type Lang = Unset;
729 }
730 pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>);
732 impl<S: State> sealed::Sealed for SetSize<S> {}
733 impl<S: State> State for SetSize<S> {
734 type Size = Set<members::size>;
735 type Lang = S::Lang;
736 }
737 pub struct SetLang<S: State = Empty>(PhantomData<fn() -> S>);
739 impl<S: State> sealed::Sealed for SetLang<S> {}
740 impl<S: State> State for SetLang<S> {
741 type Size = S::Size;
742 type Lang = Set<members::lang>;
743 }
744 #[allow(non_camel_case_types)]
746 pub mod members {
747 pub struct size(());
749 pub struct lang(());
751 }
752}
753
754pub struct IndividualLanguageSizeBuilder<'a, S: individual_language_size_state::State> {
756 _state: PhantomData<fn() -> S>,
757 _fields: (Option<CowStr<'a>>, Option<i64>),
758 _lifetime: PhantomData<&'a ()>,
759}
760
761impl<'a> IndividualLanguageSize<'a> {
762 pub fn new() -> IndividualLanguageSizeBuilder<
764 'a,
765 individual_language_size_state::Empty,
766 > {
767 IndividualLanguageSizeBuilder::new()
768 }
769}
770
771impl<'a> IndividualLanguageSizeBuilder<'a, individual_language_size_state::Empty> {
772 pub fn new() -> Self {
774 IndividualLanguageSizeBuilder {
775 _state: PhantomData,
776 _fields: (None, None),
777 _lifetime: PhantomData,
778 }
779 }
780}
781
782impl<'a, S> IndividualLanguageSizeBuilder<'a, S>
783where
784 S: individual_language_size_state::State,
785 S::Lang: individual_language_size_state::IsUnset,
786{
787 pub fn lang(
789 mut self,
790 value: impl Into<CowStr<'a>>,
791 ) -> IndividualLanguageSizeBuilder<'a, individual_language_size_state::SetLang<S>> {
792 self._fields.0 = Option::Some(value.into());
793 IndividualLanguageSizeBuilder {
794 _state: PhantomData,
795 _fields: self._fields,
796 _lifetime: PhantomData,
797 }
798 }
799}
800
801impl<'a, S> IndividualLanguageSizeBuilder<'a, S>
802where
803 S: individual_language_size_state::State,
804 S::Size: individual_language_size_state::IsUnset,
805{
806 pub fn size(
808 mut self,
809 value: impl Into<i64>,
810 ) -> IndividualLanguageSizeBuilder<'a, individual_language_size_state::SetSize<S>> {
811 self._fields.1 = Option::Some(value.into());
812 IndividualLanguageSizeBuilder {
813 _state: PhantomData,
814 _fields: self._fields,
815 _lifetime: PhantomData,
816 }
817 }
818}
819
820impl<'a, S> IndividualLanguageSizeBuilder<'a, S>
821where
822 S: individual_language_size_state::State,
823 S::Size: individual_language_size_state::IsSet,
824 S::Lang: individual_language_size_state::IsSet,
825{
826 pub fn build(self) -> IndividualLanguageSize<'a> {
828 IndividualLanguageSize {
829 lang: self._fields.0.unwrap(),
830 size: self._fields.1.unwrap(),
831 extra_data: Default::default(),
832 }
833 }
834 pub fn build_with_data(
836 self,
837 extra_data: BTreeMap<
838 jacquard_common::deps::smol_str::SmolStr,
839 jacquard_common::types::value::Data<'a>,
840 >,
841 ) -> IndividualLanguageSize<'a> {
842 IndividualLanguageSize {
843 lang: self._fields.0.unwrap(),
844 size: self._fields.1.unwrap(),
845 extra_data: Some(extra_data),
846 }
847 }
848}
849
850pub mod ref_update_state {
851
852 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
853 #[allow(unused)]
854 use ::core::marker::PhantomData;
855 mod sealed {
856 pub trait Sealed {}
857 }
858 pub trait State: sealed::Sealed {
860 type Ref;
861 type Meta;
862 type OldSha;
863 type RepoDid;
864 type CommitterDid;
865 type NewSha;
866 type RepoName;
867 }
868 pub struct Empty(());
870 impl sealed::Sealed for Empty {}
871 impl State for Empty {
872 type Ref = Unset;
873 type Meta = Unset;
874 type OldSha = Unset;
875 type RepoDid = Unset;
876 type CommitterDid = Unset;
877 type NewSha = Unset;
878 type RepoName = Unset;
879 }
880 pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>);
882 impl<S: State> sealed::Sealed for SetRef<S> {}
883 impl<S: State> State for SetRef<S> {
884 type Ref = Set<members::r#ref>;
885 type Meta = S::Meta;
886 type OldSha = S::OldSha;
887 type RepoDid = S::RepoDid;
888 type CommitterDid = S::CommitterDid;
889 type NewSha = S::NewSha;
890 type RepoName = S::RepoName;
891 }
892 pub struct SetMeta<S: State = Empty>(PhantomData<fn() -> S>);
894 impl<S: State> sealed::Sealed for SetMeta<S> {}
895 impl<S: State> State for SetMeta<S> {
896 type Ref = S::Ref;
897 type Meta = Set<members::meta>;
898 type OldSha = S::OldSha;
899 type RepoDid = S::RepoDid;
900 type CommitterDid = S::CommitterDid;
901 type NewSha = S::NewSha;
902 type RepoName = S::RepoName;
903 }
904 pub struct SetOldSha<S: State = Empty>(PhantomData<fn() -> S>);
906 impl<S: State> sealed::Sealed for SetOldSha<S> {}
907 impl<S: State> State for SetOldSha<S> {
908 type Ref = S::Ref;
909 type Meta = S::Meta;
910 type OldSha = Set<members::old_sha>;
911 type RepoDid = S::RepoDid;
912 type CommitterDid = S::CommitterDid;
913 type NewSha = S::NewSha;
914 type RepoName = S::RepoName;
915 }
916 pub struct SetRepoDid<S: State = Empty>(PhantomData<fn() -> S>);
918 impl<S: State> sealed::Sealed for SetRepoDid<S> {}
919 impl<S: State> State for SetRepoDid<S> {
920 type Ref = S::Ref;
921 type Meta = S::Meta;
922 type OldSha = S::OldSha;
923 type RepoDid = Set<members::repo_did>;
924 type CommitterDid = S::CommitterDid;
925 type NewSha = S::NewSha;
926 type RepoName = S::RepoName;
927 }
928 pub struct SetCommitterDid<S: State = Empty>(PhantomData<fn() -> S>);
930 impl<S: State> sealed::Sealed for SetCommitterDid<S> {}
931 impl<S: State> State for SetCommitterDid<S> {
932 type Ref = S::Ref;
933 type Meta = S::Meta;
934 type OldSha = S::OldSha;
935 type RepoDid = S::RepoDid;
936 type CommitterDid = Set<members::committer_did>;
937 type NewSha = S::NewSha;
938 type RepoName = S::RepoName;
939 }
940 pub struct SetNewSha<S: State = Empty>(PhantomData<fn() -> S>);
942 impl<S: State> sealed::Sealed for SetNewSha<S> {}
943 impl<S: State> State for SetNewSha<S> {
944 type Ref = S::Ref;
945 type Meta = S::Meta;
946 type OldSha = S::OldSha;
947 type RepoDid = S::RepoDid;
948 type CommitterDid = S::CommitterDid;
949 type NewSha = Set<members::new_sha>;
950 type RepoName = S::RepoName;
951 }
952 pub struct SetRepoName<S: State = Empty>(PhantomData<fn() -> S>);
954 impl<S: State> sealed::Sealed for SetRepoName<S> {}
955 impl<S: State> State for SetRepoName<S> {
956 type Ref = S::Ref;
957 type Meta = S::Meta;
958 type OldSha = S::OldSha;
959 type RepoDid = S::RepoDid;
960 type CommitterDid = S::CommitterDid;
961 type NewSha = S::NewSha;
962 type RepoName = Set<members::repo_name>;
963 }
964 #[allow(non_camel_case_types)]
966 pub mod members {
967 pub struct r#ref(());
969 pub struct meta(());
971 pub struct old_sha(());
973 pub struct repo_did(());
975 pub struct committer_did(());
977 pub struct new_sha(());
979 pub struct repo_name(());
981 }
982}
983
984pub struct RefUpdateBuilder<'a, S: ref_update_state::State> {
986 _state: PhantomData<fn() -> S>,
987 _fields: (
988 Option<Did<'a>>,
989 Option<ref_update::Meta<'a>>,
990 Option<CowStr<'a>>,
991 Option<CowStr<'a>>,
992 Option<CowStr<'a>>,
993 Option<Did<'a>>,
994 Option<CowStr<'a>>,
995 ),
996 _lifetime: PhantomData<&'a ()>,
997}
998
999impl<'a> RefUpdate<'a> {
1000 pub fn new() -> RefUpdateBuilder<'a, ref_update_state::Empty> {
1002 RefUpdateBuilder::new()
1003 }
1004}
1005
1006impl<'a> RefUpdateBuilder<'a, ref_update_state::Empty> {
1007 pub fn new() -> Self {
1009 RefUpdateBuilder {
1010 _state: PhantomData,
1011 _fields: (None, None, None, None, None, None, None),
1012 _lifetime: PhantomData,
1013 }
1014 }
1015}
1016
1017impl<'a, S> RefUpdateBuilder<'a, S>
1018where
1019 S: ref_update_state::State,
1020 S::CommitterDid: ref_update_state::IsUnset,
1021{
1022 pub fn committer_did(
1024 mut self,
1025 value: impl Into<Did<'a>>,
1026 ) -> RefUpdateBuilder<'a, ref_update_state::SetCommitterDid<S>> {
1027 self._fields.0 = Option::Some(value.into());
1028 RefUpdateBuilder {
1029 _state: PhantomData,
1030 _fields: self._fields,
1031 _lifetime: PhantomData,
1032 }
1033 }
1034}
1035
1036impl<'a, S> RefUpdateBuilder<'a, S>
1037where
1038 S: ref_update_state::State,
1039 S::Meta: ref_update_state::IsUnset,
1040{
1041 pub fn meta(
1043 mut self,
1044 value: impl Into<ref_update::Meta<'a>>,
1045 ) -> RefUpdateBuilder<'a, ref_update_state::SetMeta<S>> {
1046 self._fields.1 = Option::Some(value.into());
1047 RefUpdateBuilder {
1048 _state: PhantomData,
1049 _fields: self._fields,
1050 _lifetime: PhantomData,
1051 }
1052 }
1053}
1054
1055impl<'a, S> RefUpdateBuilder<'a, S>
1056where
1057 S: ref_update_state::State,
1058 S::NewSha: ref_update_state::IsUnset,
1059{
1060 pub fn new_sha(
1062 mut self,
1063 value: impl Into<CowStr<'a>>,
1064 ) -> RefUpdateBuilder<'a, ref_update_state::SetNewSha<S>> {
1065 self._fields.2 = Option::Some(value.into());
1066 RefUpdateBuilder {
1067 _state: PhantomData,
1068 _fields: self._fields,
1069 _lifetime: PhantomData,
1070 }
1071 }
1072}
1073
1074impl<'a, S> RefUpdateBuilder<'a, S>
1075where
1076 S: ref_update_state::State,
1077 S::OldSha: ref_update_state::IsUnset,
1078{
1079 pub fn old_sha(
1081 mut self,
1082 value: impl Into<CowStr<'a>>,
1083 ) -> RefUpdateBuilder<'a, ref_update_state::SetOldSha<S>> {
1084 self._fields.3 = Option::Some(value.into());
1085 RefUpdateBuilder {
1086 _state: PhantomData,
1087 _fields: self._fields,
1088 _lifetime: PhantomData,
1089 }
1090 }
1091}
1092
1093impl<'a, S> RefUpdateBuilder<'a, S>
1094where
1095 S: ref_update_state::State,
1096 S::Ref: ref_update_state::IsUnset,
1097{
1098 pub fn r#ref(
1100 mut self,
1101 value: impl Into<CowStr<'a>>,
1102 ) -> RefUpdateBuilder<'a, ref_update_state::SetRef<S>> {
1103 self._fields.4 = Option::Some(value.into());
1104 RefUpdateBuilder {
1105 _state: PhantomData,
1106 _fields: self._fields,
1107 _lifetime: PhantomData,
1108 }
1109 }
1110}
1111
1112impl<'a, S> RefUpdateBuilder<'a, S>
1113where
1114 S: ref_update_state::State,
1115 S::RepoDid: ref_update_state::IsUnset,
1116{
1117 pub fn repo_did(
1119 mut self,
1120 value: impl Into<Did<'a>>,
1121 ) -> RefUpdateBuilder<'a, ref_update_state::SetRepoDid<S>> {
1122 self._fields.5 = Option::Some(value.into());
1123 RefUpdateBuilder {
1124 _state: PhantomData,
1125 _fields: self._fields,
1126 _lifetime: PhantomData,
1127 }
1128 }
1129}
1130
1131impl<'a, S> RefUpdateBuilder<'a, S>
1132where
1133 S: ref_update_state::State,
1134 S::RepoName: ref_update_state::IsUnset,
1135{
1136 pub fn repo_name(
1138 mut self,
1139 value: impl Into<CowStr<'a>>,
1140 ) -> RefUpdateBuilder<'a, ref_update_state::SetRepoName<S>> {
1141 self._fields.6 = Option::Some(value.into());
1142 RefUpdateBuilder {
1143 _state: PhantomData,
1144 _fields: self._fields,
1145 _lifetime: PhantomData,
1146 }
1147 }
1148}
1149
1150impl<'a, S> RefUpdateBuilder<'a, S>
1151where
1152 S: ref_update_state::State,
1153 S::Ref: ref_update_state::IsSet,
1154 S::Meta: ref_update_state::IsSet,
1155 S::OldSha: ref_update_state::IsSet,
1156 S::RepoDid: ref_update_state::IsSet,
1157 S::CommitterDid: ref_update_state::IsSet,
1158 S::NewSha: ref_update_state::IsSet,
1159 S::RepoName: ref_update_state::IsSet,
1160{
1161 pub fn build(self) -> RefUpdate<'a> {
1163 RefUpdate {
1164 committer_did: self._fields.0.unwrap(),
1165 meta: self._fields.1.unwrap(),
1166 new_sha: self._fields.2.unwrap(),
1167 old_sha: self._fields.3.unwrap(),
1168 r#ref: self._fields.4.unwrap(),
1169 repo_did: self._fields.5.unwrap(),
1170 repo_name: self._fields.6.unwrap(),
1171 extra_data: Default::default(),
1172 }
1173 }
1174 pub fn build_with_data(
1176 self,
1177 extra_data: BTreeMap<
1178 jacquard_common::deps::smol_str::SmolStr,
1179 jacquard_common::types::value::Data<'a>,
1180 >,
1181 ) -> RefUpdate<'a> {
1182 RefUpdate {
1183 committer_did: self._fields.0.unwrap(),
1184 meta: self._fields.1.unwrap(),
1185 new_sha: self._fields.2.unwrap(),
1186 old_sha: self._fields.3.unwrap(),
1187 r#ref: self._fields.4.unwrap(),
1188 repo_did: self._fields.5.unwrap(),
1189 repo_name: self._fields.6.unwrap(),
1190 extra_data: Some(extra_data),
1191 }
1192 }
1193}
1194
1195fn _default_meta_is_default_ref() -> bool {
1196 false
1197}
1198
1199pub mod meta_state {
1200
1201 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1202 #[allow(unused)]
1203 use ::core::marker::PhantomData;
1204 mod sealed {
1205 pub trait Sealed {}
1206 }
1207 pub trait State: sealed::Sealed {
1209 type IsDefaultRef;
1210 type CommitCount;
1211 }
1212 pub struct Empty(());
1214 impl sealed::Sealed for Empty {}
1215 impl State for Empty {
1216 type IsDefaultRef = Unset;
1217 type CommitCount = Unset;
1218 }
1219 pub struct SetIsDefaultRef<S: State = Empty>(PhantomData<fn() -> S>);
1221 impl<S: State> sealed::Sealed for SetIsDefaultRef<S> {}
1222 impl<S: State> State for SetIsDefaultRef<S> {
1223 type IsDefaultRef = Set<members::is_default_ref>;
1224 type CommitCount = S::CommitCount;
1225 }
1226 pub struct SetCommitCount<S: State = Empty>(PhantomData<fn() -> S>);
1228 impl<S: State> sealed::Sealed for SetCommitCount<S> {}
1229 impl<S: State> State for SetCommitCount<S> {
1230 type IsDefaultRef = S::IsDefaultRef;
1231 type CommitCount = Set<members::commit_count>;
1232 }
1233 #[allow(non_camel_case_types)]
1235 pub mod members {
1236 pub struct is_default_ref(());
1238 pub struct commit_count(());
1240 }
1241}
1242
1243pub struct MetaBuilder<'a, S: meta_state::State> {
1245 _state: PhantomData<fn() -> S>,
1246 _fields: (
1247 Option<ref_update::CommitCountBreakdown<'a>>,
1248 Option<bool>,
1249 Option<ref_update::LangBreakdown<'a>>,
1250 ),
1251 _lifetime: PhantomData<&'a ()>,
1252}
1253
1254impl<'a> Meta<'a> {
1255 pub fn new() -> MetaBuilder<'a, meta_state::Empty> {
1257 MetaBuilder::new()
1258 }
1259}
1260
1261impl<'a> MetaBuilder<'a, meta_state::Empty> {
1262 pub fn new() -> Self {
1264 MetaBuilder {
1265 _state: PhantomData,
1266 _fields: (None, None, None),
1267 _lifetime: PhantomData,
1268 }
1269 }
1270}
1271
1272impl<'a, S> MetaBuilder<'a, S>
1273where
1274 S: meta_state::State,
1275 S::CommitCount: meta_state::IsUnset,
1276{
1277 pub fn commit_count(
1279 mut self,
1280 value: impl Into<ref_update::CommitCountBreakdown<'a>>,
1281 ) -> MetaBuilder<'a, meta_state::SetCommitCount<S>> {
1282 self._fields.0 = Option::Some(value.into());
1283 MetaBuilder {
1284 _state: PhantomData,
1285 _fields: self._fields,
1286 _lifetime: PhantomData,
1287 }
1288 }
1289}
1290
1291impl<'a, S> MetaBuilder<'a, S>
1292where
1293 S: meta_state::State,
1294 S::IsDefaultRef: meta_state::IsUnset,
1295{
1296 pub fn is_default_ref(
1298 mut self,
1299 value: impl Into<bool>,
1300 ) -> MetaBuilder<'a, meta_state::SetIsDefaultRef<S>> {
1301 self._fields.1 = Option::Some(value.into());
1302 MetaBuilder {
1303 _state: PhantomData,
1304 _fields: self._fields,
1305 _lifetime: PhantomData,
1306 }
1307 }
1308}
1309
1310impl<'a, S: meta_state::State> MetaBuilder<'a, S> {
1311 pub fn lang_breakdown(
1313 mut self,
1314 value: impl Into<Option<ref_update::LangBreakdown<'a>>>,
1315 ) -> Self {
1316 self._fields.2 = value.into();
1317 self
1318 }
1319 pub fn maybe_lang_breakdown(
1321 mut self,
1322 value: Option<ref_update::LangBreakdown<'a>>,
1323 ) -> Self {
1324 self._fields.2 = value;
1325 self
1326 }
1327}
1328
1329impl<'a, S> MetaBuilder<'a, S>
1330where
1331 S: meta_state::State,
1332 S::IsDefaultRef: meta_state::IsSet,
1333 S::CommitCount: meta_state::IsSet,
1334{
1335 pub fn build(self) -> Meta<'a> {
1337 Meta {
1338 commit_count: self._fields.0.unwrap(),
1339 is_default_ref: self._fields.1.unwrap(),
1340 lang_breakdown: self._fields.2,
1341 extra_data: Default::default(),
1342 }
1343 }
1344 pub fn build_with_data(
1346 self,
1347 extra_data: BTreeMap<
1348 jacquard_common::deps::smol_str::SmolStr,
1349 jacquard_common::types::value::Data<'a>,
1350 >,
1351 ) -> Meta<'a> {
1352 Meta {
1353 commit_count: self._fields.0.unwrap(),
1354 is_default_ref: self._fields.1.unwrap(),
1355 lang_breakdown: self._fields.2,
1356 extra_data: Some(extra_data),
1357 }
1358 }
1359}