Skip to main content

jacquard_api/sh_tangled/git/
temp.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.tangled.git.temp.defs
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8pub mod analyze_merge;
9pub mod get_archive;
10pub mod get_blob;
11pub mod get_branch;
12pub mod get_commit;
13pub mod get_diff;
14pub mod get_entity;
15pub mod get_head;
16pub mod get_tag;
17pub mod get_tree;
18pub mod list_branches;
19pub mod list_commits;
20pub mod list_languages;
21pub mod list_tags;
22
23
24#[allow(unused_imports)]
25use alloc::collections::BTreeMap;
26
27#[allow(unused_imports)]
28use core::marker::PhantomData;
29use jacquard_common::CowStr;
30
31#[allow(unused_imports)]
32use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
33use jacquard_common::types::string::Datetime;
34use jacquard_common::types::value::Data;
35use jacquard_derive::{IntoStatic, lexicon};
36use jacquard_lexicon::lexicon::LexiconDoc;
37use jacquard_lexicon::schema::LexiconSchema;
38
39#[allow(unused_imports)]
40use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
41use serde::{Serialize, Deserialize};
42use crate::sh_tangled::git::temp;
43/// blob metadata. This object doesn't include the blob content
44
45#[lexicon]
46#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
47#[serde(rename_all = "camelCase")]
48pub struct Blob<'a> {
49    #[serde(borrow)]
50    pub last_commit: temp::Commit<'a>,
51    #[serde(borrow)]
52    pub mode: CowStr<'a>,
53    ///The file name
54    #[serde(borrow)]
55    pub name: CowStr<'a>,
56    ///File size in bytes
57    pub size: i64,
58    ///Submodule information if path is a submodule
59    #[serde(skip_serializing_if = "Option::is_none")]
60    #[serde(borrow)]
61    pub submodule: Option<temp::Submodule<'a>>,
62}
63
64
65#[lexicon]
66#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
67#[serde(rename_all = "camelCase")]
68pub struct Branch<'a> {
69    ///hydrated commit object
70    #[serde(borrow)]
71    pub commit: temp::Commit<'a>,
72    ///branch name
73    #[serde(borrow)]
74    pub name: CowStr<'a>,
75}
76
77
78#[lexicon]
79#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
80#[serde(rename_all = "camelCase")]
81pub struct Commit<'a> {
82    #[serde(borrow)]
83    pub author: temp::Signature<'a>,
84    #[serde(borrow)]
85    pub committer: temp::Signature<'a>,
86    #[serde(borrow)]
87    pub hash: temp::Hash<'a>,
88    #[serde(borrow)]
89    pub message: CowStr<'a>,
90    #[serde(borrow)]
91    pub tree: temp::Hash<'a>,
92}
93
94pub type Hash<'a> = CowStr<'a>;
95
96#[lexicon]
97#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
98#[serde(rename_all = "camelCase")]
99pub struct Signature<'a> {
100    ///Person email
101    #[serde(borrow)]
102    pub email: CowStr<'a>,
103    ///Person name
104    #[serde(borrow)]
105    pub name: CowStr<'a>,
106    ///Timestamp of the signature
107    pub when: Datetime,
108}
109
110
111#[lexicon]
112#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
113#[serde(rename_all = "camelCase")]
114pub struct Submodule<'a> {
115    ///Branch to track in the submodule
116    #[serde(skip_serializing_if = "Option::is_none")]
117    #[serde(borrow)]
118    pub branch: Option<CowStr<'a>>,
119    ///Submodule name
120    #[serde(borrow)]
121    pub name: CowStr<'a>,
122    ///Submodule repository URL
123    #[serde(borrow)]
124    pub url: CowStr<'a>,
125}
126
127
128#[lexicon]
129#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
130#[serde(rename_all = "camelCase")]
131pub struct Tag<'a> {
132    #[serde(skip_serializing_if = "Option::is_none")]
133    #[serde(borrow)]
134    pub message: Option<CowStr<'a>>,
135    ///tag name
136    #[serde(borrow)]
137    pub name: CowStr<'a>,
138    #[serde(borrow)]
139    pub tagger: temp::Signature<'a>,
140    #[serde(borrow)]
141    pub target: Data<'a>,
142}
143
144impl<'a> LexiconSchema for Blob<'a> {
145    fn nsid() -> &'static str {
146        "sh.tangled.git.temp.defs"
147    }
148    fn def_name() -> &'static str {
149        "blob"
150    }
151    fn lexicon_doc() -> LexiconDoc<'static> {
152        lexicon_doc_sh_tangled_git_temp_defs()
153    }
154    fn validate(&self) -> Result<(), ConstraintError> {
155        Ok(())
156    }
157}
158
159impl<'a> LexiconSchema for Branch<'a> {
160    fn nsid() -> &'static str {
161        "sh.tangled.git.temp.defs"
162    }
163    fn def_name() -> &'static str {
164        "branch"
165    }
166    fn lexicon_doc() -> LexiconDoc<'static> {
167        lexicon_doc_sh_tangled_git_temp_defs()
168    }
169    fn validate(&self) -> Result<(), ConstraintError> {
170        Ok(())
171    }
172}
173
174impl<'a> LexiconSchema for Commit<'a> {
175    fn nsid() -> &'static str {
176        "sh.tangled.git.temp.defs"
177    }
178    fn def_name() -> &'static str {
179        "commit"
180    }
181    fn lexicon_doc() -> LexiconDoc<'static> {
182        lexicon_doc_sh_tangled_git_temp_defs()
183    }
184    fn validate(&self) -> Result<(), ConstraintError> {
185        Ok(())
186    }
187}
188
189impl<'a> LexiconSchema for Signature<'a> {
190    fn nsid() -> &'static str {
191        "sh.tangled.git.temp.defs"
192    }
193    fn def_name() -> &'static str {
194        "signature"
195    }
196    fn lexicon_doc() -> LexiconDoc<'static> {
197        lexicon_doc_sh_tangled_git_temp_defs()
198    }
199    fn validate(&self) -> Result<(), ConstraintError> {
200        Ok(())
201    }
202}
203
204impl<'a> LexiconSchema for Submodule<'a> {
205    fn nsid() -> &'static str {
206        "sh.tangled.git.temp.defs"
207    }
208    fn def_name() -> &'static str {
209        "submodule"
210    }
211    fn lexicon_doc() -> LexiconDoc<'static> {
212        lexicon_doc_sh_tangled_git_temp_defs()
213    }
214    fn validate(&self) -> Result<(), ConstraintError> {
215        Ok(())
216    }
217}
218
219impl<'a> LexiconSchema for Tag<'a> {
220    fn nsid() -> &'static str {
221        "sh.tangled.git.temp.defs"
222    }
223    fn def_name() -> &'static str {
224        "tag"
225    }
226    fn lexicon_doc() -> LexiconDoc<'static> {
227        lexicon_doc_sh_tangled_git_temp_defs()
228    }
229    fn validate(&self) -> Result<(), ConstraintError> {
230        Ok(())
231    }
232}
233
234pub mod blob_state {
235
236    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
237    #[allow(unused)]
238    use ::core::marker::PhantomData;
239    mod sealed {
240        pub trait Sealed {}
241    }
242    /// State trait tracking which required fields have been set
243    pub trait State: sealed::Sealed {
244        type LastCommit;
245        type Name;
246        type Mode;
247        type Size;
248    }
249    /// Empty state - all required fields are unset
250    pub struct Empty(());
251    impl sealed::Sealed for Empty {}
252    impl State for Empty {
253        type LastCommit = Unset;
254        type Name = Unset;
255        type Mode = Unset;
256        type Size = Unset;
257    }
258    ///State transition - sets the `last_commit` field to Set
259    pub struct SetLastCommit<S: State = Empty>(PhantomData<fn() -> S>);
260    impl<S: State> sealed::Sealed for SetLastCommit<S> {}
261    impl<S: State> State for SetLastCommit<S> {
262        type LastCommit = Set<members::last_commit>;
263        type Name = S::Name;
264        type Mode = S::Mode;
265        type Size = S::Size;
266    }
267    ///State transition - sets the `name` field to Set
268    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
269    impl<S: State> sealed::Sealed for SetName<S> {}
270    impl<S: State> State for SetName<S> {
271        type LastCommit = S::LastCommit;
272        type Name = Set<members::name>;
273        type Mode = S::Mode;
274        type Size = S::Size;
275    }
276    ///State transition - sets the `mode` field to Set
277    pub struct SetMode<S: State = Empty>(PhantomData<fn() -> S>);
278    impl<S: State> sealed::Sealed for SetMode<S> {}
279    impl<S: State> State for SetMode<S> {
280        type LastCommit = S::LastCommit;
281        type Name = S::Name;
282        type Mode = Set<members::mode>;
283        type Size = S::Size;
284    }
285    ///State transition - sets the `size` field to Set
286    pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>);
287    impl<S: State> sealed::Sealed for SetSize<S> {}
288    impl<S: State> State for SetSize<S> {
289        type LastCommit = S::LastCommit;
290        type Name = S::Name;
291        type Mode = S::Mode;
292        type Size = Set<members::size>;
293    }
294    /// Marker types for field names
295    #[allow(non_camel_case_types)]
296    pub mod members {
297        ///Marker type for the `last_commit` field
298        pub struct last_commit(());
299        ///Marker type for the `name` field
300        pub struct name(());
301        ///Marker type for the `mode` field
302        pub struct mode(());
303        ///Marker type for the `size` field
304        pub struct size(());
305    }
306}
307
308/// Builder for constructing an instance of this type
309pub struct BlobBuilder<'a, S: blob_state::State> {
310    _state: PhantomData<fn() -> S>,
311    _fields: (
312        Option<temp::Commit<'a>>,
313        Option<CowStr<'a>>,
314        Option<CowStr<'a>>,
315        Option<i64>,
316        Option<temp::Submodule<'a>>,
317    ),
318    _lifetime: PhantomData<&'a ()>,
319}
320
321impl<'a> Blob<'a> {
322    /// Create a new builder for this type
323    pub fn new() -> BlobBuilder<'a, blob_state::Empty> {
324        BlobBuilder::new()
325    }
326}
327
328impl<'a> BlobBuilder<'a, blob_state::Empty> {
329    /// Create a new builder with all fields unset
330    pub fn new() -> Self {
331        BlobBuilder {
332            _state: PhantomData,
333            _fields: (None, None, None, None, None),
334            _lifetime: PhantomData,
335        }
336    }
337}
338
339impl<'a, S> BlobBuilder<'a, S>
340where
341    S: blob_state::State,
342    S::LastCommit: blob_state::IsUnset,
343{
344    /// Set the `lastCommit` field (required)
345    pub fn last_commit(
346        mut self,
347        value: impl Into<temp::Commit<'a>>,
348    ) -> BlobBuilder<'a, blob_state::SetLastCommit<S>> {
349        self._fields.0 = Option::Some(value.into());
350        BlobBuilder {
351            _state: PhantomData,
352            _fields: self._fields,
353            _lifetime: PhantomData,
354        }
355    }
356}
357
358impl<'a, S> BlobBuilder<'a, S>
359where
360    S: blob_state::State,
361    S::Mode: blob_state::IsUnset,
362{
363    /// Set the `mode` field (required)
364    pub fn mode(
365        mut self,
366        value: impl Into<CowStr<'a>>,
367    ) -> BlobBuilder<'a, blob_state::SetMode<S>> {
368        self._fields.1 = Option::Some(value.into());
369        BlobBuilder {
370            _state: PhantomData,
371            _fields: self._fields,
372            _lifetime: PhantomData,
373        }
374    }
375}
376
377impl<'a, S> BlobBuilder<'a, S>
378where
379    S: blob_state::State,
380    S::Name: blob_state::IsUnset,
381{
382    /// Set the `name` field (required)
383    pub fn name(
384        mut self,
385        value: impl Into<CowStr<'a>>,
386    ) -> BlobBuilder<'a, blob_state::SetName<S>> {
387        self._fields.2 = Option::Some(value.into());
388        BlobBuilder {
389            _state: PhantomData,
390            _fields: self._fields,
391            _lifetime: PhantomData,
392        }
393    }
394}
395
396impl<'a, S> BlobBuilder<'a, S>
397where
398    S: blob_state::State,
399    S::Size: blob_state::IsUnset,
400{
401    /// Set the `size` field (required)
402    pub fn size(
403        mut self,
404        value: impl Into<i64>,
405    ) -> BlobBuilder<'a, blob_state::SetSize<S>> {
406        self._fields.3 = Option::Some(value.into());
407        BlobBuilder {
408            _state: PhantomData,
409            _fields: self._fields,
410            _lifetime: PhantomData,
411        }
412    }
413}
414
415impl<'a, S: blob_state::State> BlobBuilder<'a, S> {
416    /// Set the `submodule` field (optional)
417    pub fn submodule(mut self, value: impl Into<Option<temp::Submodule<'a>>>) -> Self {
418        self._fields.4 = value.into();
419        self
420    }
421    /// Set the `submodule` field to an Option value (optional)
422    pub fn maybe_submodule(mut self, value: Option<temp::Submodule<'a>>) -> Self {
423        self._fields.4 = value;
424        self
425    }
426}
427
428impl<'a, S> BlobBuilder<'a, S>
429where
430    S: blob_state::State,
431    S::LastCommit: blob_state::IsSet,
432    S::Name: blob_state::IsSet,
433    S::Mode: blob_state::IsSet,
434    S::Size: blob_state::IsSet,
435{
436    /// Build the final struct
437    pub fn build(self) -> Blob<'a> {
438        Blob {
439            last_commit: self._fields.0.unwrap(),
440            mode: self._fields.1.unwrap(),
441            name: self._fields.2.unwrap(),
442            size: self._fields.3.unwrap(),
443            submodule: self._fields.4,
444            extra_data: Default::default(),
445        }
446    }
447    /// Build the final struct with custom extra_data
448    pub fn build_with_data(
449        self,
450        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
451    ) -> Blob<'a> {
452        Blob {
453            last_commit: self._fields.0.unwrap(),
454            mode: self._fields.1.unwrap(),
455            name: self._fields.2.unwrap(),
456            size: self._fields.3.unwrap(),
457            submodule: self._fields.4,
458            extra_data: Some(extra_data),
459        }
460    }
461}
462
463fn lexicon_doc_sh_tangled_git_temp_defs() -> LexiconDoc<'static> {
464    #[allow(unused_imports)]
465    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
466    use jacquard_lexicon::lexicon::*;
467    use alloc::collections::BTreeMap;
468    LexiconDoc {
469        lexicon: Lexicon::Lexicon1,
470        id: CowStr::new_static("sh.tangled.git.temp.defs"),
471        defs: {
472            let mut map = BTreeMap::new();
473            map.insert(
474                SmolStr::new_static("blob"),
475                LexUserType::Object(LexObject {
476                    description: Some(
477                        CowStr::new_static(
478                            "blob metadata. This object doesn't include the blob content",
479                        ),
480                    ),
481                    required: Some(
482                        vec![
483                            SmolStr::new_static("name"), SmolStr::new_static("mode"),
484                            SmolStr::new_static("size"),
485                            SmolStr::new_static("lastCommit")
486                        ],
487                    ),
488                    properties: {
489                        #[allow(unused_mut)]
490                        let mut map = BTreeMap::new();
491                        map.insert(
492                            SmolStr::new_static("lastCommit"),
493                            LexObjectProperty::Ref(LexRef {
494                                r#ref: CowStr::new_static("#commit"),
495                                ..Default::default()
496                            }),
497                        );
498                        map.insert(
499                            SmolStr::new_static("mode"),
500                            LexObjectProperty::String(LexString { ..Default::default() }),
501                        );
502                        map.insert(
503                            SmolStr::new_static("name"),
504                            LexObjectProperty::String(LexString {
505                                description: Some(CowStr::new_static("The file name")),
506                                ..Default::default()
507                            }),
508                        );
509                        map.insert(
510                            SmolStr::new_static("size"),
511                            LexObjectProperty::Integer(LexInteger {
512                                ..Default::default()
513                            }),
514                        );
515                        map.insert(
516                            SmolStr::new_static("submodule"),
517                            LexObjectProperty::Ref(LexRef {
518                                r#ref: CowStr::new_static("#submodule"),
519                                ..Default::default()
520                            }),
521                        );
522                        map
523                    },
524                    ..Default::default()
525                }),
526            );
527            map.insert(
528                SmolStr::new_static("branch"),
529                LexUserType::Object(LexObject {
530                    required: Some(
531                        vec![SmolStr::new_static("name"), SmolStr::new_static("commit")],
532                    ),
533                    properties: {
534                        #[allow(unused_mut)]
535                        let mut map = BTreeMap::new();
536                        map.insert(
537                            SmolStr::new_static("commit"),
538                            LexObjectProperty::Ref(LexRef {
539                                r#ref: CowStr::new_static("#commit"),
540                                ..Default::default()
541                            }),
542                        );
543                        map.insert(
544                            SmolStr::new_static("name"),
545                            LexObjectProperty::String(LexString {
546                                description: Some(CowStr::new_static("branch name")),
547                                ..Default::default()
548                            }),
549                        );
550                        map
551                    },
552                    ..Default::default()
553                }),
554            );
555            map.insert(
556                SmolStr::new_static("commit"),
557                LexUserType::Object(LexObject {
558                    required: Some(
559                        vec![
560                            SmolStr::new_static("hash"), SmolStr::new_static("author"),
561                            SmolStr::new_static("committer"),
562                            SmolStr::new_static("message"), SmolStr::new_static("tree")
563                        ],
564                    ),
565                    properties: {
566                        #[allow(unused_mut)]
567                        let mut map = BTreeMap::new();
568                        map.insert(
569                            SmolStr::new_static("author"),
570                            LexObjectProperty::Ref(LexRef {
571                                r#ref: CowStr::new_static("#signature"),
572                                ..Default::default()
573                            }),
574                        );
575                        map.insert(
576                            SmolStr::new_static("committer"),
577                            LexObjectProperty::Ref(LexRef {
578                                r#ref: CowStr::new_static("#signature"),
579                                ..Default::default()
580                            }),
581                        );
582                        map.insert(
583                            SmolStr::new_static("hash"),
584                            LexObjectProperty::Ref(LexRef {
585                                r#ref: CowStr::new_static("#hash"),
586                                ..Default::default()
587                            }),
588                        );
589                        map.insert(
590                            SmolStr::new_static("message"),
591                            LexObjectProperty::String(LexString { ..Default::default() }),
592                        );
593                        map.insert(
594                            SmolStr::new_static("tree"),
595                            LexObjectProperty::Ref(LexRef {
596                                r#ref: CowStr::new_static("#hash"),
597                                ..Default::default()
598                            }),
599                        );
600                        map
601                    },
602                    ..Default::default()
603                }),
604            );
605            map.insert(
606                SmolStr::new_static("hash"),
607                LexUserType::String(LexString { ..Default::default() }),
608            );
609            map.insert(
610                SmolStr::new_static("signature"),
611                LexUserType::Object(LexObject {
612                    required: Some(
613                        vec![
614                            SmolStr::new_static("name"), SmolStr::new_static("email"),
615                            SmolStr::new_static("when")
616                        ],
617                    ),
618                    properties: {
619                        #[allow(unused_mut)]
620                        let mut map = BTreeMap::new();
621                        map.insert(
622                            SmolStr::new_static("email"),
623                            LexObjectProperty::String(LexString {
624                                description: Some(CowStr::new_static("Person email")),
625                                ..Default::default()
626                            }),
627                        );
628                        map.insert(
629                            SmolStr::new_static("name"),
630                            LexObjectProperty::String(LexString {
631                                description: Some(CowStr::new_static("Person name")),
632                                ..Default::default()
633                            }),
634                        );
635                        map.insert(
636                            SmolStr::new_static("when"),
637                            LexObjectProperty::String(LexString {
638                                description: Some(
639                                    CowStr::new_static("Timestamp of the signature"),
640                                ),
641                                format: Some(LexStringFormat::Datetime),
642                                ..Default::default()
643                            }),
644                        );
645                        map
646                    },
647                    ..Default::default()
648                }),
649            );
650            map.insert(
651                SmolStr::new_static("submodule"),
652                LexUserType::Object(LexObject {
653                    required: Some(
654                        vec![SmolStr::new_static("name"), SmolStr::new_static("url")],
655                    ),
656                    properties: {
657                        #[allow(unused_mut)]
658                        let mut map = BTreeMap::new();
659                        map.insert(
660                            SmolStr::new_static("branch"),
661                            LexObjectProperty::String(LexString {
662                                description: Some(
663                                    CowStr::new_static("Branch to track in the submodule"),
664                                ),
665                                ..Default::default()
666                            }),
667                        );
668                        map.insert(
669                            SmolStr::new_static("name"),
670                            LexObjectProperty::String(LexString {
671                                description: Some(CowStr::new_static("Submodule name")),
672                                ..Default::default()
673                            }),
674                        );
675                        map.insert(
676                            SmolStr::new_static("url"),
677                            LexObjectProperty::String(LexString {
678                                description: Some(
679                                    CowStr::new_static("Submodule repository URL"),
680                                ),
681                                ..Default::default()
682                            }),
683                        );
684                        map
685                    },
686                    ..Default::default()
687                }),
688            );
689            map.insert(
690                SmolStr::new_static("tag"),
691                LexUserType::Object(LexObject {
692                    required: Some(
693                        vec![
694                            SmolStr::new_static("name"), SmolStr::new_static("tagger"),
695                            SmolStr::new_static("target")
696                        ],
697                    ),
698                    properties: {
699                        #[allow(unused_mut)]
700                        let mut map = BTreeMap::new();
701                        map.insert(
702                            SmolStr::new_static("message"),
703                            LexObjectProperty::String(LexString { ..Default::default() }),
704                        );
705                        map.insert(
706                            SmolStr::new_static("name"),
707                            LexObjectProperty::String(LexString {
708                                description: Some(CowStr::new_static("tag name")),
709                                ..Default::default()
710                            }),
711                        );
712                        map.insert(
713                            SmolStr::new_static("tagger"),
714                            LexObjectProperty::Ref(LexRef {
715                                r#ref: CowStr::new_static("#signature"),
716                                ..Default::default()
717                            }),
718                        );
719                        map.insert(
720                            SmolStr::new_static("target"),
721                            LexObjectProperty::Unknown(LexUnknown {
722                                ..Default::default()
723                            }),
724                        );
725                        map
726                    },
727                    ..Default::default()
728                }),
729            );
730            map
731        },
732        ..Default::default()
733    }
734}
735
736pub mod branch_state {
737
738    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
739    #[allow(unused)]
740    use ::core::marker::PhantomData;
741    mod sealed {
742        pub trait Sealed {}
743    }
744    /// State trait tracking which required fields have been set
745    pub trait State: sealed::Sealed {
746        type Commit;
747        type Name;
748    }
749    /// Empty state - all required fields are unset
750    pub struct Empty(());
751    impl sealed::Sealed for Empty {}
752    impl State for Empty {
753        type Commit = Unset;
754        type Name = Unset;
755    }
756    ///State transition - sets the `commit` field to Set
757    pub struct SetCommit<S: State = Empty>(PhantomData<fn() -> S>);
758    impl<S: State> sealed::Sealed for SetCommit<S> {}
759    impl<S: State> State for SetCommit<S> {
760        type Commit = Set<members::commit>;
761        type Name = S::Name;
762    }
763    ///State transition - sets the `name` field to Set
764    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
765    impl<S: State> sealed::Sealed for SetName<S> {}
766    impl<S: State> State for SetName<S> {
767        type Commit = S::Commit;
768        type Name = Set<members::name>;
769    }
770    /// Marker types for field names
771    #[allow(non_camel_case_types)]
772    pub mod members {
773        ///Marker type for the `commit` field
774        pub struct commit(());
775        ///Marker type for the `name` field
776        pub struct name(());
777    }
778}
779
780/// Builder for constructing an instance of this type
781pub struct BranchBuilder<'a, S: branch_state::State> {
782    _state: PhantomData<fn() -> S>,
783    _fields: (Option<temp::Commit<'a>>, Option<CowStr<'a>>),
784    _lifetime: PhantomData<&'a ()>,
785}
786
787impl<'a> Branch<'a> {
788    /// Create a new builder for this type
789    pub fn new() -> BranchBuilder<'a, branch_state::Empty> {
790        BranchBuilder::new()
791    }
792}
793
794impl<'a> BranchBuilder<'a, branch_state::Empty> {
795    /// Create a new builder with all fields unset
796    pub fn new() -> Self {
797        BranchBuilder {
798            _state: PhantomData,
799            _fields: (None, None),
800            _lifetime: PhantomData,
801        }
802    }
803}
804
805impl<'a, S> BranchBuilder<'a, S>
806where
807    S: branch_state::State,
808    S::Commit: branch_state::IsUnset,
809{
810    /// Set the `commit` field (required)
811    pub fn commit(
812        mut self,
813        value: impl Into<temp::Commit<'a>>,
814    ) -> BranchBuilder<'a, branch_state::SetCommit<S>> {
815        self._fields.0 = Option::Some(value.into());
816        BranchBuilder {
817            _state: PhantomData,
818            _fields: self._fields,
819            _lifetime: PhantomData,
820        }
821    }
822}
823
824impl<'a, S> BranchBuilder<'a, S>
825where
826    S: branch_state::State,
827    S::Name: branch_state::IsUnset,
828{
829    /// Set the `name` field (required)
830    pub fn name(
831        mut self,
832        value: impl Into<CowStr<'a>>,
833    ) -> BranchBuilder<'a, branch_state::SetName<S>> {
834        self._fields.1 = Option::Some(value.into());
835        BranchBuilder {
836            _state: PhantomData,
837            _fields: self._fields,
838            _lifetime: PhantomData,
839        }
840    }
841}
842
843impl<'a, S> BranchBuilder<'a, S>
844where
845    S: branch_state::State,
846    S::Commit: branch_state::IsSet,
847    S::Name: branch_state::IsSet,
848{
849    /// Build the final struct
850    pub fn build(self) -> Branch<'a> {
851        Branch {
852            commit: self._fields.0.unwrap(),
853            name: self._fields.1.unwrap(),
854            extra_data: Default::default(),
855        }
856    }
857    /// Build the final struct with custom extra_data
858    pub fn build_with_data(
859        self,
860        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
861    ) -> Branch<'a> {
862        Branch {
863            commit: self._fields.0.unwrap(),
864            name: self._fields.1.unwrap(),
865            extra_data: Some(extra_data),
866        }
867    }
868}
869
870pub mod commit_state {
871
872    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
873    #[allow(unused)]
874    use ::core::marker::PhantomData;
875    mod sealed {
876        pub trait Sealed {}
877    }
878    /// State trait tracking which required fields have been set
879    pub trait State: sealed::Sealed {
880        type Author;
881        type Committer;
882        type Hash;
883        type Message;
884        type Tree;
885    }
886    /// Empty state - all required fields are unset
887    pub struct Empty(());
888    impl sealed::Sealed for Empty {}
889    impl State for Empty {
890        type Author = Unset;
891        type Committer = Unset;
892        type Hash = Unset;
893        type Message = Unset;
894        type Tree = Unset;
895    }
896    ///State transition - sets the `author` field to Set
897    pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
898    impl<S: State> sealed::Sealed for SetAuthor<S> {}
899    impl<S: State> State for SetAuthor<S> {
900        type Author = Set<members::author>;
901        type Committer = S::Committer;
902        type Hash = S::Hash;
903        type Message = S::Message;
904        type Tree = S::Tree;
905    }
906    ///State transition - sets the `committer` field to Set
907    pub struct SetCommitter<S: State = Empty>(PhantomData<fn() -> S>);
908    impl<S: State> sealed::Sealed for SetCommitter<S> {}
909    impl<S: State> State for SetCommitter<S> {
910        type Author = S::Author;
911        type Committer = Set<members::committer>;
912        type Hash = S::Hash;
913        type Message = S::Message;
914        type Tree = S::Tree;
915    }
916    ///State transition - sets the `hash` field to Set
917    pub struct SetHash<S: State = Empty>(PhantomData<fn() -> S>);
918    impl<S: State> sealed::Sealed for SetHash<S> {}
919    impl<S: State> State for SetHash<S> {
920        type Author = S::Author;
921        type Committer = S::Committer;
922        type Hash = Set<members::hash>;
923        type Message = S::Message;
924        type Tree = S::Tree;
925    }
926    ///State transition - sets the `message` field to Set
927    pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>);
928    impl<S: State> sealed::Sealed for SetMessage<S> {}
929    impl<S: State> State for SetMessage<S> {
930        type Author = S::Author;
931        type Committer = S::Committer;
932        type Hash = S::Hash;
933        type Message = Set<members::message>;
934        type Tree = S::Tree;
935    }
936    ///State transition - sets the `tree` field to Set
937    pub struct SetTree<S: State = Empty>(PhantomData<fn() -> S>);
938    impl<S: State> sealed::Sealed for SetTree<S> {}
939    impl<S: State> State for SetTree<S> {
940        type Author = S::Author;
941        type Committer = S::Committer;
942        type Hash = S::Hash;
943        type Message = S::Message;
944        type Tree = Set<members::tree>;
945    }
946    /// Marker types for field names
947    #[allow(non_camel_case_types)]
948    pub mod members {
949        ///Marker type for the `author` field
950        pub struct author(());
951        ///Marker type for the `committer` field
952        pub struct committer(());
953        ///Marker type for the `hash` field
954        pub struct hash(());
955        ///Marker type for the `message` field
956        pub struct message(());
957        ///Marker type for the `tree` field
958        pub struct tree(());
959    }
960}
961
962/// Builder for constructing an instance of this type
963pub struct CommitBuilder<'a, S: commit_state::State> {
964    _state: PhantomData<fn() -> S>,
965    _fields: (
966        Option<temp::Signature<'a>>,
967        Option<temp::Signature<'a>>,
968        Option<temp::Hash<'a>>,
969        Option<CowStr<'a>>,
970        Option<temp::Hash<'a>>,
971    ),
972    _lifetime: PhantomData<&'a ()>,
973}
974
975impl<'a> Commit<'a> {
976    /// Create a new builder for this type
977    pub fn new() -> CommitBuilder<'a, commit_state::Empty> {
978        CommitBuilder::new()
979    }
980}
981
982impl<'a> CommitBuilder<'a, commit_state::Empty> {
983    /// Create a new builder with all fields unset
984    pub fn new() -> Self {
985        CommitBuilder {
986            _state: PhantomData,
987            _fields: (None, None, None, None, None),
988            _lifetime: PhantomData,
989        }
990    }
991}
992
993impl<'a, S> CommitBuilder<'a, S>
994where
995    S: commit_state::State,
996    S::Author: commit_state::IsUnset,
997{
998    /// Set the `author` field (required)
999    pub fn author(
1000        mut self,
1001        value: impl Into<temp::Signature<'a>>,
1002    ) -> CommitBuilder<'a, commit_state::SetAuthor<S>> {
1003        self._fields.0 = Option::Some(value.into());
1004        CommitBuilder {
1005            _state: PhantomData,
1006            _fields: self._fields,
1007            _lifetime: PhantomData,
1008        }
1009    }
1010}
1011
1012impl<'a, S> CommitBuilder<'a, S>
1013where
1014    S: commit_state::State,
1015    S::Committer: commit_state::IsUnset,
1016{
1017    /// Set the `committer` field (required)
1018    pub fn committer(
1019        mut self,
1020        value: impl Into<temp::Signature<'a>>,
1021    ) -> CommitBuilder<'a, commit_state::SetCommitter<S>> {
1022        self._fields.1 = Option::Some(value.into());
1023        CommitBuilder {
1024            _state: PhantomData,
1025            _fields: self._fields,
1026            _lifetime: PhantomData,
1027        }
1028    }
1029}
1030
1031impl<'a, S> CommitBuilder<'a, S>
1032where
1033    S: commit_state::State,
1034    S::Hash: commit_state::IsUnset,
1035{
1036    /// Set the `hash` field (required)
1037    pub fn hash(
1038        mut self,
1039        value: impl Into<temp::Hash<'a>>,
1040    ) -> CommitBuilder<'a, commit_state::SetHash<S>> {
1041        self._fields.2 = Option::Some(value.into());
1042        CommitBuilder {
1043            _state: PhantomData,
1044            _fields: self._fields,
1045            _lifetime: PhantomData,
1046        }
1047    }
1048}
1049
1050impl<'a, S> CommitBuilder<'a, S>
1051where
1052    S: commit_state::State,
1053    S::Message: commit_state::IsUnset,
1054{
1055    /// Set the `message` field (required)
1056    pub fn message(
1057        mut self,
1058        value: impl Into<CowStr<'a>>,
1059    ) -> CommitBuilder<'a, commit_state::SetMessage<S>> {
1060        self._fields.3 = Option::Some(value.into());
1061        CommitBuilder {
1062            _state: PhantomData,
1063            _fields: self._fields,
1064            _lifetime: PhantomData,
1065        }
1066    }
1067}
1068
1069impl<'a, S> CommitBuilder<'a, S>
1070where
1071    S: commit_state::State,
1072    S::Tree: commit_state::IsUnset,
1073{
1074    /// Set the `tree` field (required)
1075    pub fn tree(
1076        mut self,
1077        value: impl Into<temp::Hash<'a>>,
1078    ) -> CommitBuilder<'a, commit_state::SetTree<S>> {
1079        self._fields.4 = Option::Some(value.into());
1080        CommitBuilder {
1081            _state: PhantomData,
1082            _fields: self._fields,
1083            _lifetime: PhantomData,
1084        }
1085    }
1086}
1087
1088impl<'a, S> CommitBuilder<'a, S>
1089where
1090    S: commit_state::State,
1091    S::Author: commit_state::IsSet,
1092    S::Committer: commit_state::IsSet,
1093    S::Hash: commit_state::IsSet,
1094    S::Message: commit_state::IsSet,
1095    S::Tree: commit_state::IsSet,
1096{
1097    /// Build the final struct
1098    pub fn build(self) -> Commit<'a> {
1099        Commit {
1100            author: self._fields.0.unwrap(),
1101            committer: self._fields.1.unwrap(),
1102            hash: self._fields.2.unwrap(),
1103            message: self._fields.3.unwrap(),
1104            tree: self._fields.4.unwrap(),
1105            extra_data: Default::default(),
1106        }
1107    }
1108    /// Build the final struct with custom extra_data
1109    pub fn build_with_data(
1110        self,
1111        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1112    ) -> Commit<'a> {
1113        Commit {
1114            author: self._fields.0.unwrap(),
1115            committer: self._fields.1.unwrap(),
1116            hash: self._fields.2.unwrap(),
1117            message: self._fields.3.unwrap(),
1118            tree: self._fields.4.unwrap(),
1119            extra_data: Some(extra_data),
1120        }
1121    }
1122}
1123
1124pub mod signature_state {
1125
1126    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1127    #[allow(unused)]
1128    use ::core::marker::PhantomData;
1129    mod sealed {
1130        pub trait Sealed {}
1131    }
1132    /// State trait tracking which required fields have been set
1133    pub trait State: sealed::Sealed {
1134        type When;
1135        type Name;
1136        type Email;
1137    }
1138    /// Empty state - all required fields are unset
1139    pub struct Empty(());
1140    impl sealed::Sealed for Empty {}
1141    impl State for Empty {
1142        type When = Unset;
1143        type Name = Unset;
1144        type Email = Unset;
1145    }
1146    ///State transition - sets the `when` field to Set
1147    pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>);
1148    impl<S: State> sealed::Sealed for SetWhen<S> {}
1149    impl<S: State> State for SetWhen<S> {
1150        type When = Set<members::when>;
1151        type Name = S::Name;
1152        type Email = S::Email;
1153    }
1154    ///State transition - sets the `name` field to Set
1155    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
1156    impl<S: State> sealed::Sealed for SetName<S> {}
1157    impl<S: State> State for SetName<S> {
1158        type When = S::When;
1159        type Name = Set<members::name>;
1160        type Email = S::Email;
1161    }
1162    ///State transition - sets the `email` field to Set
1163    pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>);
1164    impl<S: State> sealed::Sealed for SetEmail<S> {}
1165    impl<S: State> State for SetEmail<S> {
1166        type When = S::When;
1167        type Name = S::Name;
1168        type Email = Set<members::email>;
1169    }
1170    /// Marker types for field names
1171    #[allow(non_camel_case_types)]
1172    pub mod members {
1173        ///Marker type for the `when` field
1174        pub struct when(());
1175        ///Marker type for the `name` field
1176        pub struct name(());
1177        ///Marker type for the `email` field
1178        pub struct email(());
1179    }
1180}
1181
1182/// Builder for constructing an instance of this type
1183pub struct SignatureBuilder<'a, S: signature_state::State> {
1184    _state: PhantomData<fn() -> S>,
1185    _fields: (Option<CowStr<'a>>, Option<CowStr<'a>>, Option<Datetime>),
1186    _lifetime: PhantomData<&'a ()>,
1187}
1188
1189impl<'a> Signature<'a> {
1190    /// Create a new builder for this type
1191    pub fn new() -> SignatureBuilder<'a, signature_state::Empty> {
1192        SignatureBuilder::new()
1193    }
1194}
1195
1196impl<'a> SignatureBuilder<'a, signature_state::Empty> {
1197    /// Create a new builder with all fields unset
1198    pub fn new() -> Self {
1199        SignatureBuilder {
1200            _state: PhantomData,
1201            _fields: (None, None, None),
1202            _lifetime: PhantomData,
1203        }
1204    }
1205}
1206
1207impl<'a, S> SignatureBuilder<'a, S>
1208where
1209    S: signature_state::State,
1210    S::Email: signature_state::IsUnset,
1211{
1212    /// Set the `email` field (required)
1213    pub fn email(
1214        mut self,
1215        value: impl Into<CowStr<'a>>,
1216    ) -> SignatureBuilder<'a, signature_state::SetEmail<S>> {
1217        self._fields.0 = Option::Some(value.into());
1218        SignatureBuilder {
1219            _state: PhantomData,
1220            _fields: self._fields,
1221            _lifetime: PhantomData,
1222        }
1223    }
1224}
1225
1226impl<'a, S> SignatureBuilder<'a, S>
1227where
1228    S: signature_state::State,
1229    S::Name: signature_state::IsUnset,
1230{
1231    /// Set the `name` field (required)
1232    pub fn name(
1233        mut self,
1234        value: impl Into<CowStr<'a>>,
1235    ) -> SignatureBuilder<'a, signature_state::SetName<S>> {
1236        self._fields.1 = Option::Some(value.into());
1237        SignatureBuilder {
1238            _state: PhantomData,
1239            _fields: self._fields,
1240            _lifetime: PhantomData,
1241        }
1242    }
1243}
1244
1245impl<'a, S> SignatureBuilder<'a, S>
1246where
1247    S: signature_state::State,
1248    S::When: signature_state::IsUnset,
1249{
1250    /// Set the `when` field (required)
1251    pub fn when(
1252        mut self,
1253        value: impl Into<Datetime>,
1254    ) -> SignatureBuilder<'a, signature_state::SetWhen<S>> {
1255        self._fields.2 = Option::Some(value.into());
1256        SignatureBuilder {
1257            _state: PhantomData,
1258            _fields: self._fields,
1259            _lifetime: PhantomData,
1260        }
1261    }
1262}
1263
1264impl<'a, S> SignatureBuilder<'a, S>
1265where
1266    S: signature_state::State,
1267    S::When: signature_state::IsSet,
1268    S::Name: signature_state::IsSet,
1269    S::Email: signature_state::IsSet,
1270{
1271    /// Build the final struct
1272    pub fn build(self) -> Signature<'a> {
1273        Signature {
1274            email: self._fields.0.unwrap(),
1275            name: self._fields.1.unwrap(),
1276            when: self._fields.2.unwrap(),
1277            extra_data: Default::default(),
1278        }
1279    }
1280    /// Build the final struct with custom extra_data
1281    pub fn build_with_data(
1282        self,
1283        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1284    ) -> Signature<'a> {
1285        Signature {
1286            email: self._fields.0.unwrap(),
1287            name: self._fields.1.unwrap(),
1288            when: self._fields.2.unwrap(),
1289            extra_data: Some(extra_data),
1290        }
1291    }
1292}
1293
1294pub mod tag_state {
1295
1296    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1297    #[allow(unused)]
1298    use ::core::marker::PhantomData;
1299    mod sealed {
1300        pub trait Sealed {}
1301    }
1302    /// State trait tracking which required fields have been set
1303    pub trait State: sealed::Sealed {
1304        type Name;
1305        type Tagger;
1306        type Target;
1307    }
1308    /// Empty state - all required fields are unset
1309    pub struct Empty(());
1310    impl sealed::Sealed for Empty {}
1311    impl State for Empty {
1312        type Name = Unset;
1313        type Tagger = Unset;
1314        type Target = Unset;
1315    }
1316    ///State transition - sets the `name` field to Set
1317    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
1318    impl<S: State> sealed::Sealed for SetName<S> {}
1319    impl<S: State> State for SetName<S> {
1320        type Name = Set<members::name>;
1321        type Tagger = S::Tagger;
1322        type Target = S::Target;
1323    }
1324    ///State transition - sets the `tagger` field to Set
1325    pub struct SetTagger<S: State = Empty>(PhantomData<fn() -> S>);
1326    impl<S: State> sealed::Sealed for SetTagger<S> {}
1327    impl<S: State> State for SetTagger<S> {
1328        type Name = S::Name;
1329        type Tagger = Set<members::tagger>;
1330        type Target = S::Target;
1331    }
1332    ///State transition - sets the `target` field to Set
1333    pub struct SetTarget<S: State = Empty>(PhantomData<fn() -> S>);
1334    impl<S: State> sealed::Sealed for SetTarget<S> {}
1335    impl<S: State> State for SetTarget<S> {
1336        type Name = S::Name;
1337        type Tagger = S::Tagger;
1338        type Target = Set<members::target>;
1339    }
1340    /// Marker types for field names
1341    #[allow(non_camel_case_types)]
1342    pub mod members {
1343        ///Marker type for the `name` field
1344        pub struct name(());
1345        ///Marker type for the `tagger` field
1346        pub struct tagger(());
1347        ///Marker type for the `target` field
1348        pub struct target(());
1349    }
1350}
1351
1352/// Builder for constructing an instance of this type
1353pub struct TagBuilder<'a, S: tag_state::State> {
1354    _state: PhantomData<fn() -> S>,
1355    _fields: (
1356        Option<CowStr<'a>>,
1357        Option<CowStr<'a>>,
1358        Option<temp::Signature<'a>>,
1359        Option<Data<'a>>,
1360    ),
1361    _lifetime: PhantomData<&'a ()>,
1362}
1363
1364impl<'a> Tag<'a> {
1365    /// Create a new builder for this type
1366    pub fn new() -> TagBuilder<'a, tag_state::Empty> {
1367        TagBuilder::new()
1368    }
1369}
1370
1371impl<'a> TagBuilder<'a, tag_state::Empty> {
1372    /// Create a new builder with all fields unset
1373    pub fn new() -> Self {
1374        TagBuilder {
1375            _state: PhantomData,
1376            _fields: (None, None, None, None),
1377            _lifetime: PhantomData,
1378        }
1379    }
1380}
1381
1382impl<'a, S: tag_state::State> TagBuilder<'a, S> {
1383    /// Set the `message` field (optional)
1384    pub fn message(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
1385        self._fields.0 = value.into();
1386        self
1387    }
1388    /// Set the `message` field to an Option value (optional)
1389    pub fn maybe_message(mut self, value: Option<CowStr<'a>>) -> Self {
1390        self._fields.0 = value;
1391        self
1392    }
1393}
1394
1395impl<'a, S> TagBuilder<'a, S>
1396where
1397    S: tag_state::State,
1398    S::Name: tag_state::IsUnset,
1399{
1400    /// Set the `name` field (required)
1401    pub fn name(
1402        mut self,
1403        value: impl Into<CowStr<'a>>,
1404    ) -> TagBuilder<'a, tag_state::SetName<S>> {
1405        self._fields.1 = Option::Some(value.into());
1406        TagBuilder {
1407            _state: PhantomData,
1408            _fields: self._fields,
1409            _lifetime: PhantomData,
1410        }
1411    }
1412}
1413
1414impl<'a, S> TagBuilder<'a, S>
1415where
1416    S: tag_state::State,
1417    S::Tagger: tag_state::IsUnset,
1418{
1419    /// Set the `tagger` field (required)
1420    pub fn tagger(
1421        mut self,
1422        value: impl Into<temp::Signature<'a>>,
1423    ) -> TagBuilder<'a, tag_state::SetTagger<S>> {
1424        self._fields.2 = Option::Some(value.into());
1425        TagBuilder {
1426            _state: PhantomData,
1427            _fields: self._fields,
1428            _lifetime: PhantomData,
1429        }
1430    }
1431}
1432
1433impl<'a, S> TagBuilder<'a, S>
1434where
1435    S: tag_state::State,
1436    S::Target: tag_state::IsUnset,
1437{
1438    /// Set the `target` field (required)
1439    pub fn target(
1440        mut self,
1441        value: impl Into<Data<'a>>,
1442    ) -> TagBuilder<'a, tag_state::SetTarget<S>> {
1443        self._fields.3 = Option::Some(value.into());
1444        TagBuilder {
1445            _state: PhantomData,
1446            _fields: self._fields,
1447            _lifetime: PhantomData,
1448        }
1449    }
1450}
1451
1452impl<'a, S> TagBuilder<'a, S>
1453where
1454    S: tag_state::State,
1455    S::Name: tag_state::IsSet,
1456    S::Tagger: tag_state::IsSet,
1457    S::Target: tag_state::IsSet,
1458{
1459    /// Build the final struct
1460    pub fn build(self) -> Tag<'a> {
1461        Tag {
1462            message: self._fields.0,
1463            name: self._fields.1.unwrap(),
1464            tagger: self._fields.2.unwrap(),
1465            target: self._fields.3.unwrap(),
1466            extra_data: Default::default(),
1467        }
1468    }
1469    /// Build the final struct with custom extra_data
1470    pub fn build_with_data(
1471        self,
1472        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
1473    ) -> Tag<'a> {
1474        Tag {
1475            message: self._fields.0,
1476            name: self._fields.1.unwrap(),
1477            tagger: self._fields.2.unwrap(),
1478            target: self._fields.3.unwrap(),
1479            extra_data: Some(extra_data),
1480        }
1481    }
1482}