11//! `chain` rule type impl.
22
33use anyhow:: ensure;
4- use catalyst_signed_doc_spec:: { is_required:: IsRequired , metadata:: chain:: Chain } ;
5- use catalyst_signed_doc_spec:: metadata:: collaborators:: Collaborators ;
6- use crate :: {
7- CatalystSignedDocument , providers:: CatalystSignedDocumentProvider ,
4+ use catalyst_signed_doc_spec:: {
5+ is_required:: IsRequired ,
6+ metadata:: { chain:: Chain , collaborators:: Collaborators } ,
87} ;
98
9+ use crate :: { CatalystSignedDocument , providers:: CatalystSignedDocumentProvider } ;
10+
1011#[ cfg( test) ]
1112mod tests;
1213
@@ -24,16 +25,22 @@ pub(crate) enum ChainRule {
2425
2526impl ChainRule {
2627 /// Generating `ChainRule` from specs
27- pub ( crate ) fn new ( spec : & Chain , collaborators_spec : & Collaborators ) -> anyhow:: Result < Self > {
28+ pub ( crate ) fn new (
29+ spec : & Chain ,
30+ collaborators_spec : & Collaborators ,
31+ ) -> anyhow:: Result < Self > {
2832 let optional = match spec. required {
2933 IsRequired :: Yes => false ,
3034 IsRequired :: Optional => true ,
3135 IsRequired :: Excluded => {
3236 return Ok ( Self :: NotSpecified ) ;
33- }
37+ } ,
3438 } ;
3539
36- ensure ! ( matches!( collaborators_spec. required, IsRequired :: Excluded ) , "Chained Documents do not support collaborators" ) ;
40+ ensure ! (
41+ matches!( collaborators_spec. required, IsRequired :: Excluded ) ,
42+ "Chained Documents do not support collaborators"
43+ ) ;
3744
3845 Ok ( Self :: Specified { optional } )
3946 }
0 commit comments