1use derive_getters::Getters;
7
8use super::core::*;
9use super::error::*;
10use super::parser::*;
11use super::stmt::*;
12use super::substmt::*;
13
14use crate::collect_a_stmt;
15use crate::collect_opt_stmt;
16use crate::collect_vec_stmt;
17
18pub trait Compound {
22 fn keywords() -> Vec<Keyword> {
24 panic!("undefined");
25 }
26
27 fn substmts_def() -> Vec<SubStmtDef>;
29}
30
31#[derive(Debug, Clone, PartialEq, Getters)]
35pub struct ModuleHeaderStmts {
36 yang_version: Option<YangVersionStmt>,
38
39 namespace: NamespaceStmt,
41
42 prefix: PrefixStmt,
44}
45
46impl Compound for ModuleHeaderStmts {
47 fn substmts_def() -> Vec<SubStmtDef> {
49 vec![
50 SubStmtDef::Optional(SubStmtWith::Stmt(YangVersionStmt::keyword)),
51 SubStmtDef::HasOne(SubStmtWith::Stmt(NamespaceStmt::keyword)),
52 SubStmtDef::HasOne(SubStmtWith::Stmt(PrefixStmt::keyword)),
53 ]
54 }
55}
56
57impl ModuleHeaderStmts {
58 pub fn parse(parser: &mut Parser) -> Result<ModuleHeaderStmts, YangError> {
60 let mut stmts = SubStmtUtil::parse_substmts(parser, Self::substmts_def())?;
61
62 Ok(ModuleHeaderStmts {
63 yang_version: collect_opt_stmt!(stmts, YangVersionStmt)?,
64 namespace: collect_a_stmt!(stmts, NamespaceStmt)?,
65 prefix: collect_a_stmt!(stmts, PrefixStmt)?,
66 })
67 }
68}
69
70#[derive(Debug, Clone, PartialEq, Getters)]
74pub struct SubmoduleHeaderStmts {
75 yang_version: Option<YangVersionStmt>,
77
78 belongs_to: BelongsToStmt,
80}
81
82impl Compound for SubmoduleHeaderStmts {
83 fn substmts_def() -> Vec<SubStmtDef> {
85 vec![
86 SubStmtDef::Optional(SubStmtWith::Stmt(YangVersionStmt::keyword)),
87 SubStmtDef::HasOne(SubStmtWith::Stmt(BelongsToStmt::keyword)),
88 ]
89 }
90}
91
92impl SubmoduleHeaderStmts {
93 pub fn parse(parser: &mut Parser) -> Result<SubmoduleHeaderStmts, YangError> {
95 let mut stmts = SubStmtUtil::parse_substmts(parser, Self::substmts_def())?;
96
97 Ok(SubmoduleHeaderStmts {
98 yang_version: collect_opt_stmt!(stmts, YangVersionStmt)?,
99 belongs_to: collect_a_stmt!(stmts, BelongsToStmt)?,
100 })
101 }
102}
103
104#[derive(Debug, Clone, PartialEq, Getters)]
108pub struct BodyStmts {
109 extension: Vec<ExtensionStmt>,
111
112 feature: Vec<FeatureStmt>,
114
115 identity: Vec<IdentityStmt>,
117
118 typedef: Vec<TypedefStmt>,
120
121 grouping: Vec<GroupingStmt>,
123
124 data_def: DataDefStmt,
126
127 augment: Vec<AugmentStmt>,
129
130 rpc: Vec<RpcStmt>,
132
133 notification: Vec<NotificationStmt>,
135
136 deviation: Vec<DeviationStmt>,
138}
139
140impl Compound for BodyStmts {
141 fn substmts_def() -> Vec<SubStmtDef> {
143 vec![
144 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(ExtensionStmt::keyword)),
145 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(FeatureStmt::keyword)),
146 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(IdentityStmt::keyword)),
147 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(TypedefStmt::keyword)),
148 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(GroupingStmt::keyword)),
149 SubStmtDef::ZeroOrMore(SubStmtWith::Selection(DataDefStmt::keywords)),
150 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(AugmentStmt::keyword)),
151 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(RpcStmt::keyword)),
152 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(NotificationStmt::keyword)),
153 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(DeviationStmt::keyword)),
154 ]
155 }
156}
157
158impl BodyStmts {
159 pub fn parse(parser: &mut Parser) -> Result<BodyStmts, YangError> {
160 let mut stmts = SubStmtUtil::parse_substmts(parser, Self::substmts_def())?;
161
162 Ok(BodyStmts {
163 extension: collect_vec_stmt!(stmts, ExtensionStmt)?,
164 feature: collect_vec_stmt!(stmts, FeatureStmt)?,
165 identity: collect_vec_stmt!(stmts, IdentityStmt)?,
166 typedef: collect_vec_stmt!(stmts, TypedefStmt)?,
167 grouping: collect_vec_stmt!(stmts, GroupingStmt)?,
168 data_def: DataDefStmt::new_with_substmts((
169 collect_vec_stmt!(stmts, ContainerStmt)?,
170 collect_vec_stmt!(stmts, LeafStmt)?,
171 collect_vec_stmt!(stmts, LeafListStmt)?,
172 collect_vec_stmt!(stmts, ListStmt)?,
173 collect_vec_stmt!(stmts, ChoiceStmt)?,
174 collect_vec_stmt!(stmts, AnydataStmt)?,
175 collect_vec_stmt!(stmts, AnyxmlStmt)?,
176 collect_vec_stmt!(stmts, UsesStmt)?,
177 )),
178 augment: collect_vec_stmt!(stmts, AugmentStmt)?,
179 rpc: collect_vec_stmt!(stmts, RpcStmt)?,
180 notification: collect_vec_stmt!(stmts, NotificationStmt)?,
181 deviation: collect_vec_stmt!(stmts, DeviationStmt)?,
182 })
183 }
184}
185
186#[derive(Debug, Clone, PartialEq, Getters)]
190pub struct MetaStmts {
191 organization: Option<OrganizationStmt>,
193
194 contact: Option<ContactStmt>,
196
197 description: Option<DescriptionStmt>,
199
200 reference: Option<ReferenceStmt>,
202}
203
204impl Compound for MetaStmts {
205 fn substmts_def() -> Vec<SubStmtDef> {
207 vec![
208 SubStmtDef::Optional(SubStmtWith::Stmt(OrganizationStmt::keyword)),
209 SubStmtDef::Optional(SubStmtWith::Stmt(ContactStmt::keyword)),
210 SubStmtDef::Optional(SubStmtWith::Stmt(DescriptionStmt::keyword)),
211 SubStmtDef::Optional(SubStmtWith::Stmt(ReferenceStmt::keyword)),
212 ]
213 }
214}
215
216impl MetaStmts {
217 pub fn parse(parser: &mut Parser) -> Result<MetaStmts, YangError> {
218 let mut stmts = SubStmtUtil::parse_substmts(parser, Self::substmts_def())?;
219
220 Ok(MetaStmts {
221 organization: collect_opt_stmt!(stmts, OrganizationStmt)?,
222 contact: collect_opt_stmt!(stmts, ContactStmt)?,
223 description: collect_opt_stmt!(stmts, DescriptionStmt)?,
224 reference: collect_opt_stmt!(stmts, ReferenceStmt)?,
225 })
226 }
227}
228
229#[derive(Debug, Clone, PartialEq, Getters)]
233pub struct LinkageStmts {
234 import: Vec<ImportStmt>,
236
237 include: Vec<IncludeStmt>,
239}
240
241impl Compound for LinkageStmts {
242 fn substmts_def() -> Vec<SubStmtDef> {
244 vec![
245 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(ImportStmt::keyword)),
246 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(IncludeStmt::keyword)),
247 ]
248 }
249}
250
251impl LinkageStmts {
252 pub fn parse(parser: &mut Parser) -> Result<LinkageStmts, YangError> {
253 let mut stmts = SubStmtUtil::parse_substmts(parser, Self::substmts_def())?;
254
255 Ok(LinkageStmts {
256 import: collect_vec_stmt!(stmts, ImportStmt)?,
257 include: collect_vec_stmt!(stmts, IncludeStmt)?,
258 })
259 }
260}
261
262#[derive(Debug, Clone, PartialEq, Getters)]
266pub struct RevisionStmts {
267 revision: Vec<RevisionStmt>,
269}
270
271impl Compound for RevisionStmts {
272 fn substmts_def() -> Vec<SubStmtDef> {
274 vec![SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(
275 RevisionStmt::keyword,
276 ))]
277 }
278}
279
280impl RevisionStmts {
281 pub fn parse(parser: &mut Parser) -> Result<RevisionStmts, YangError> {
282 let mut stmts = SubStmtUtil::parse_substmts(parser, Self::substmts_def())?;
283
284 Ok(RevisionStmts {
285 revision: collect_vec_stmt!(stmts, RevisionStmt)?,
286 })
287 }
288}
289
290#[derive(Debug, Clone, PartialEq, Getters)]
294pub struct NumericalRestrictions {
295 range: Option<RangeStmt>,
297}
298
299impl Compound for NumericalRestrictions {
300 fn substmts_def() -> Vec<SubStmtDef> {
302 vec![SubStmtDef::Optional(SubStmtWith::Stmt(RangeStmt::keyword))]
303 }
304}
305
306impl NumericalRestrictions {
307 pub fn parse(parser: &mut Parser) -> Result<NumericalRestrictions, YangError> {
308 let mut stmts = SubStmtUtil::parse_substmts(parser, Self::substmts_def())?;
309
310 Ok(NumericalRestrictions {
311 range: collect_opt_stmt!(stmts, RangeStmt)?,
312 })
313 }
314}
315
316#[derive(Debug, Clone, PartialEq, Getters)]
320pub struct Decimal64Specification {
321 fraction_digits: FractionDigitsStmt,
323
324 range: Option<RangeStmt>,
326}
327
328impl Compound for Decimal64Specification {
329 fn substmts_def() -> Vec<SubStmtDef> {
331 vec![
332 SubStmtDef::HasOne(SubStmtWith::Stmt(FractionDigitsStmt::keyword)),
333 SubStmtDef::Optional(SubStmtWith::Stmt(RangeStmt::keyword)),
334 ]
335 }
336}
337
338impl Decimal64Specification {
339 pub fn parse(parser: &mut Parser) -> Result<Decimal64Specification, YangError> {
340 let mut stmts = SubStmtUtil::parse_substmts(parser, Self::substmts_def())?;
341
342 Ok(Decimal64Specification {
343 fraction_digits: collect_a_stmt!(stmts, FractionDigitsStmt)?,
344 range: collect_opt_stmt!(stmts, RangeStmt)?,
345 })
346 }
347}
348
349#[derive(Debug, Clone, PartialEq, Getters)]
353pub struct StringRestrictions {
354 length: Option<LengthStmt>,
356
357 pattern: Vec<PatternStmt>,
359}
360
361#[derive(Debug, Clone, PartialEq, Getters)]
365pub struct EnumSpecification {
366 enum_: Vec<EnumStmt>,
368}
369
370#[derive(Debug, Clone, PartialEq, Getters)]
374pub struct LeafrefSpecification {
375 path: PathStmt,
377
378 require_instance: Option<RequireInstanceStmt>,
380}
381
382#[derive(Debug, Clone, PartialEq, Getters)]
386pub struct IdentityrefSpecification {
387 base: Vec<BaseStmt>,
389}
390
391#[derive(Debug, Clone, PartialEq, Getters)]
395pub struct InstanceIdentifierSpecification {
396 require_instance: Option<RequireInstanceStmt>,
398}
399
400#[derive(Debug, Clone, PartialEq, Getters)]
404pub struct BitsSpecification {
405 bit: Vec<BitStmt>,
407}
408
409#[derive(Debug, Clone, PartialEq, Getters)]
413pub struct UnionSpecification {
414 type_: Vec<TypeStmt>,
416}
417
418#[derive(Debug, Clone, PartialEq, Getters)]
422pub struct BinarySpecification {
423 length: Option<LengthStmt>,
425}
426
427#[derive(Debug, Clone, PartialEq)]
431pub enum TypeBodyStmts {
432 NumericalRestrictions(NumericalRestrictions),
433 Decimal64Specification(Decimal64Specification),
434 StringRestrictions(StringRestrictions),
435 EnumSpecification(EnumSpecification),
436 LeafrefSpecification(LeafrefSpecification),
437 IdentityrefSpecification(IdentityrefSpecification),
438 InstanceIdentifierSpecification(InstanceIdentifierSpecification),
439 BitsSpecification(BitsSpecification),
440 UnionSpecification(UnionSpecification),
441 BinarySpecification(BinarySpecification),
442}
443
444impl TypeBodyStmts {
445 pub fn substmts_def() -> Vec<SubStmtDef> {
447 vec![
448 SubStmtDef::Optional(SubStmtWith::Stmt(FractionDigitsStmt::keyword)),
449 SubStmtDef::Optional(SubStmtWith::Stmt(RangeStmt::keyword)),
450 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(PatternStmt::keyword)),
451 SubStmtDef::Optional(SubStmtWith::Stmt(LengthStmt::keyword)),
452 SubStmtDef::Optional(SubStmtWith::Stmt(PathStmt::keyword)),
453 SubStmtDef::Optional(SubStmtWith::Stmt(RequireInstanceStmt::keyword)),
454 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(EnumStmt::keyword)),
455 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(BaseStmt::keyword)),
456 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(BitStmt::keyword)),
457 SubStmtDef::ZeroOrMore(SubStmtWith::Stmt(TypeStmt::keyword)),
458 ]
459 }
461
462 pub fn parse(parser: &mut Parser) -> Result<TypeBodyStmts, YangError> {
473 let mut stmts = SubStmtUtil::parse_substmts(parser, Self::substmts_def())?;
474
475 let type_body = if let Ok(fraction_digits) = collect_a_stmt!(stmts, FractionDigitsStmt) {
476 let range = if let Ok(range) = collect_a_stmt!(stmts, RangeStmt) {
477 Some(range)
478 } else {
479 None
480 };
481
482 TypeBodyStmts::Decimal64Specification(Decimal64Specification {
483 fraction_digits,
484 range,
485 })
486 } else if let Ok(range) = collect_a_stmt!(stmts, RangeStmt) {
487 TypeBodyStmts::NumericalRestrictions(NumericalRestrictions { range: Some(range) })
488 } else if let Ok(pattern) = collect_vec_stmt!(stmts, PatternStmt) {
489 let length = if let Ok(length) = collect_a_stmt!(stmts, LengthStmt) {
491 Some(length)
492 } else {
493 None
494 };
495
496 TypeBodyStmts::StringRestrictions(StringRestrictions { pattern, length })
497 } else if let Ok(length) = collect_a_stmt!(stmts, LengthStmt) {
498 TypeBodyStmts::BinarySpecification(BinarySpecification {
499 length: Some(length),
500 })
501 } else if let Ok(path) = collect_a_stmt!(stmts, PathStmt) {
502 let require_instance =
503 if let Ok(require_instance) = collect_a_stmt!(stmts, RequireInstanceStmt) {
504 Some(require_instance)
505 } else {
506 None
507 };
508
509 TypeBodyStmts::LeafrefSpecification(LeafrefSpecification {
510 path,
511 require_instance,
512 })
513 } else if let Ok(require_instance) = collect_a_stmt!(stmts, RequireInstanceStmt) {
514 TypeBodyStmts::InstanceIdentifierSpecification(InstanceIdentifierSpecification {
515 require_instance: Some(require_instance),
516 })
517 } else if let Ok(enum_) = collect_vec_stmt!(stmts, EnumStmt) {
518 TypeBodyStmts::EnumSpecification(EnumSpecification { enum_ })
519 } else if let Ok(base) = collect_vec_stmt!(stmts, BaseStmt) {
520 TypeBodyStmts::IdentityrefSpecification(IdentityrefSpecification { base })
521 } else if let Ok(bit) = collect_vec_stmt!(stmts, BitStmt) {
522 TypeBodyStmts::BitsSpecification(BitsSpecification { bit })
523 } else if let Ok(type_) = collect_vec_stmt!(stmts, TypeStmt) {
524 TypeBodyStmts::UnionSpecification(UnionSpecification { type_ })
525 } else {
526 return Err(YangError::MissingStatement(""));
527 };
528
529 Ok(type_body)
530 }
531}
532
533pub trait Selection {
537 type SubStmts;
539
540 fn keywords() -> Vec<Keyword> {
542 panic!("undefined");
543 }
544
545 fn new() -> Self
547 where
548 Self: Sized,
549 {
550 panic!("{:?}", Self::keywords());
551 }
552
553 fn new_with_substmts(_substmts: Self::SubStmts) -> Self
555 where
556 Self: Sized,
557 {
558 panic!("{:?}", Self::keywords());
559 }
560}
561
562#[derive(Debug, Clone, PartialEq, Getters)]
566pub struct TypedefOrGrouping {
567 typedef: Vec<TypedefStmt>,
569
570 grouping: Vec<GroupingStmt>,
572}
573
574impl Selection for TypedefOrGrouping {
575 type SubStmts = (Vec<TypedefStmt>, Vec<GroupingStmt>);
577
578 fn keywords() -> Vec<Keyword> {
580 vec![TypedefStmt::keyword(), GroupingStmt::keyword()]
581 }
582
583 fn new() -> Self
585 where
586 Self: Sized,
587 {
588 Self {
589 typedef: Vec::new(),
590 grouping: Vec::new(),
591 }
592 }
593
594 fn new_with_substmts(substmts: Self::SubStmts) -> Self
596 where
597 Self: Sized,
598 {
599 Self {
600 typedef: substmts.0,
601 grouping: substmts.1,
602 }
603 }
604}
605
606#[derive(Debug, Clone, PartialEq, Getters)]
610pub struct DataDefStmt {
611 container: Vec<ContainerStmt>,
613
614 leaf: Vec<LeafStmt>,
616
617 leaf_list: Vec<LeafListStmt>,
619
620 list: Vec<ListStmt>,
622
623 choice: Vec<ChoiceStmt>,
625
626 anydata: Vec<AnydataStmt>,
628
629 anyxml: Vec<AnyxmlStmt>,
631
632 uses: Vec<UsesStmt>,
634}
635
636impl Selection for DataDefStmt {
637 type SubStmts = (
639 Vec<ContainerStmt>,
640 Vec<LeafStmt>,
641 Vec<LeafListStmt>,
642 Vec<ListStmt>,
643 Vec<ChoiceStmt>,
644 Vec<AnydataStmt>,
645 Vec<AnyxmlStmt>,
646 Vec<UsesStmt>,
647 );
648
649 fn keywords() -> Vec<Keyword> {
651 vec![
652 ContainerStmt::keyword(),
653 LeafStmt::keyword(),
654 LeafListStmt::keyword(),
655 ListStmt::keyword(),
656 ChoiceStmt::keyword(),
657 AnydataStmt::keyword(),
658 AnyxmlStmt::keyword(),
659 UsesStmt::keyword(),
660 ]
661 }
662
663 fn new() -> Self
665 where
666 Self: Sized,
667 {
668 Self {
669 container: Vec::new(),
670 leaf: Vec::new(),
671 leaf_list: Vec::new(),
672 list: Vec::new(),
673 choice: Vec::new(),
674 anydata: Vec::new(),
675 anyxml: Vec::new(),
676 uses: Vec::new(),
677 }
678 }
679
680 fn new_with_substmts(substmts: Self::SubStmts) -> Self
682 where
683 Self: Sized,
684 {
685 Self {
686 container: substmts.0,
687 leaf: substmts.1,
688 leaf_list: substmts.2,
689 list: substmts.3,
690 choice: substmts.4,
691 anydata: substmts.5,
692 anyxml: substmts.6,
693 uses: substmts.7,
694 }
695 }
696}
697
698#[derive(Debug, Clone, PartialEq, Getters)]
702pub struct DataDefOrElse {
703 container: Vec<ContainerStmt>,
705
706 leaf: Vec<LeafStmt>,
708
709 leaf_list: Vec<LeafListStmt>,
711
712 list: Vec<ListStmt>,
714
715 choice: Vec<ChoiceStmt>,
717
718 anydata: Vec<AnydataStmt>,
720
721 anyxml: Vec<AnyxmlStmt>,
723
724 uses: Vec<UsesStmt>,
726
727 case: Vec<CaseStmt>,
729
730 action: Vec<ActionStmt>,
732
733 notification: Vec<NotificationStmt>,
735}
736
737impl Selection for DataDefOrElse {
738 type SubStmts = (
740 Vec<ContainerStmt>,
741 Vec<LeafStmt>,
742 Vec<LeafListStmt>,
743 Vec<ListStmt>,
744 Vec<ChoiceStmt>,
745 Vec<AnydataStmt>,
746 Vec<AnyxmlStmt>,
747 Vec<UsesStmt>,
748 Vec<CaseStmt>,
749 Vec<ActionStmt>,
750 Vec<NotificationStmt>,
751 );
752
753 fn keywords() -> Vec<Keyword> {
755 vec![
756 ContainerStmt::keyword(),
757 LeafStmt::keyword(),
758 LeafListStmt::keyword(),
759 ListStmt::keyword(),
760 ChoiceStmt::keyword(),
761 AnydataStmt::keyword(),
762 AnyxmlStmt::keyword(),
763 UsesStmt::keyword(),
764 CaseStmt::keyword(),
765 ActionStmt::keyword(),
766 NotificationStmt::keyword(),
767 ]
768 }
769
770 fn new() -> Self
772 where
773 Self: Sized,
774 {
775 Self {
776 container: Vec::new(),
777 leaf: Vec::new(),
778 leaf_list: Vec::new(),
779 list: Vec::new(),
780 choice: Vec::new(),
781 anydata: Vec::new(),
782 anyxml: Vec::new(),
783 uses: Vec::new(),
784 case: Vec::new(),
785 action: Vec::new(),
786 notification: Vec::new(),
787 }
788 }
789
790 fn new_with_substmts(substmts: Self::SubStmts) -> Self
792 where
793 Self: Sized,
794 {
795 Self {
796 container: substmts.0,
797 leaf: substmts.1,
798 leaf_list: substmts.2,
799 list: substmts.3,
800 choice: substmts.4,
801 anydata: substmts.5,
802 anyxml: substmts.6,
803 uses: substmts.7,
804 case: substmts.8,
805 action: substmts.9,
806 notification: substmts.10,
807 }
808 }
809}
810
811#[derive(Debug, Clone, PartialEq, Getters)]
815pub struct ShortCaseOrCaseStmt {
816 choice: Vec<ChoiceStmt>,
818
819 container: Vec<ContainerStmt>,
821
822 leaf: Vec<LeafStmt>,
824
825 leaf_list: Vec<LeafListStmt>,
827
828 list: Vec<ListStmt>,
830
831 anydata: Vec<AnydataStmt>,
833
834 anyxml: Vec<AnyxmlStmt>,
836
837 case: Vec<CaseStmt>,
839}
840
841impl Selection for ShortCaseOrCaseStmt {
842 type SubStmts = (
844 Vec<ChoiceStmt>,
845 Vec<ContainerStmt>,
846 Vec<LeafStmt>,
847 Vec<LeafListStmt>,
848 Vec<ListStmt>,
849 Vec<AnydataStmt>,
850 Vec<AnyxmlStmt>,
851 Vec<CaseStmt>,
852 );
853
854 fn keywords() -> Vec<Keyword> {
856 vec![
857 ChoiceStmt::keyword(),
858 ContainerStmt::keyword(),
859 LeafStmt::keyword(),
860 LeafListStmt::keyword(),
861 ListStmt::keyword(),
862 AnydataStmt::keyword(),
863 AnyxmlStmt::keyword(),
864 CaseStmt::keyword(),
865 ]
866 }
867
868 fn new() -> Self
870 where
871 Self: Sized,
872 {
873 Self {
874 choice: Vec::new(),
875 container: Vec::new(),
876 leaf: Vec::new(),
877 leaf_list: Vec::new(),
878 list: Vec::new(),
879 anydata: Vec::new(),
880 anyxml: Vec::new(),
881 case: Vec::new(),
882 }
883 }
884
885 fn new_with_substmts(substmts: Self::SubStmts) -> Self
887 where
888 Self: Sized,
889 {
890 Self {
891 choice: substmts.0,
892 container: substmts.1,
893 leaf: substmts.2,
894 leaf_list: substmts.3,
895 list: substmts.4,
896 anydata: substmts.5,
897 anyxml: substmts.6,
898 case: substmts.7,
899 }
900 }
901}