fn spec_deps<'a>(spec: &'a Spec<'_>) -> Vec<(String, &'a Spec<'a>)> {
            let mut deps = Vec::new();
            let mut q = VecDeque::new();

            // Initializes the specs exploration queue
            if let Spec::Struct(fields) = spec {
                for (f_name, f_spec) in fields {
                    match f_spec {
                        Spec::Value(_) => (),
                        Spec::Array(inner) => q.push_back((f_name.to_camel_case(), &**inner)),
                        Spec::Struct(_) => q.push_back((f_name.to_camel_case(), f_spec)),
                    }
                }
            } else {
                unreachable!("All specs are Spec::Struct(_)");
            }

            // Builds the specs dependencies stack
            while let Some((ref f_name, ref f_spec)) = q.pop_front() {
                match (f_name, f_spec) {
                    (_, Spec::Value(_)) => (),
                    (_, Spec::Array(inner)) => q.push_back((f_name.to_camel_case(), &**inner)),
                    (_, Spec::Struct(fields)) => {
                        for (f_name, f_spec) in fields {
                            match f_spec {
                                Spec::Value(_) => (),
                                Spec::Array(inner) => {
                                    q.push_back((f_name.to_camel_case(), &**inner))
                                }
                                Spec::Struct(_) => q.push_back((f_name.to_camel_case(), f_spec)),
                            }
                        }
                        deps.push((f_name.to_camel_case(), &**f_spec));
                    }
                }
            }

            deps
        }
/// Returns a stack of the inner structs of a given spec.
Returns a stack of the inner structs of a given spec.
Returns a stack of the inner structs of a given spec .
fn spec_deps<'a>(spec: &'a Spec<'_>) -> Vec<(String, &'a Spec<'a>)> {
            let mut deps = Vec::new();
            let mut q = VecDeque::new();
            // Initializes the specs exploration queue
            if let Spec::Struct(fields) = spec {
                for (f_name, f_spec) in fields {
                    match f_spec {
                        Spec::Value(_) => (),
                        Spec::Array(inner) => q.push_back((f_name.to_camel_case(), &**inner)),
                        Spec::Struct(_) => q.push_back((f_name.to_camel_case(), f_spec)),
                    }
                }
            } else {
                unreachable!("All specs are Spec::Struct(_)");
            }
            // Builds the specs dependencies stack
            while let Some((ref f_name, ref f_spec)) = q.pop_front() {
                match (f_name, f_spec) {
                    (_, Spec::Value(_)) => (),
                    (_, Spec::Array(inner)) => q.push_back((f_name.to_camel_case(), &**inner)),
                    (_, Spec::Struct(fields)) => {
                        for (f_name, f_spec) in fields {
                            match f_spec {
                                Spec::Value(_) => (),
                                Spec::Array(inner) => {
                                    q.push_back((f_name.to_camel_case(), &**inner))
                                }
                                Spec::Struct(_) => q.push_back((f_name.to_camel_case(), f_spec)),
                            }
                        }
                        deps.push((f_name.to_camel_case(), &**f_spec));
                    }
                }
            }
            deps
        }
fn spec_deps < ' a > ( spec : & ' a Spec < ' _ > ) -> Vec < ( String , & ' a Spec < ' a > ) > { let mut deps = Vec :: new ( ) ; let mut q = VecDeque :: new ( ) ; // Initializes the specs exploration queue if let Spec :: Struct ( fields ) = spec { for ( f_name , f_spec ) in fields { match f_spec { Spec :: Value ( _ ) => ( ) , Spec :: Array ( inner ) => q . push_back ( ( f_name . to_camel_case ( ) , & * * inner ) ) , Spec :: Struct ( _ ) => q . push_back ( ( f_name . to_camel_case ( ) , f_spec ) ) , } } } else { unreachable ! ( " " ) ; } // Builds the specs dependencies stack while let Some ( ( ref f_name , ref f_spec ) ) = q . pop_front ( ) { match ( f_name , f_spec ) { ( _ , Spec :: Value ( _ ) ) => ( ) , ( _ , Spec :: Array ( inner ) ) => q . push_back ( ( f_name . to_camel_case ( ) , & * * inner ) ) , ( _ , Spec :: Struct ( fields ) ) => { for ( f_name , f_spec ) in fields { match f_spec { Spec :: Value ( _ ) => ( ) , Spec :: Array ( inner ) => { q . push_back ( ( f_name . to_camel_case ( ) , & * * inner ) ) } Spec :: Struct ( _ ) => q . push_back ( ( f_name . to_camel_case ( ) , f_spec ) ) , } } deps . push ( ( f_name . to_camel_case ( ) , & * * f_spec ) ) ; } } } deps }
Returns a stack of the inner structs of a given spec.
Returns a stack of the inner structs of a given spec .
spec
&'a Spec<'_>