fn transitive_dependency_count(&self) -> usize {
        match self {
            Self::Primitive(_) => 0,
            Self::Tuple { item_types } => item_types
                .iter()
                .map(|i| 1 + i.transitive_dependency_count())
                .sum(),
            Self::List { item_type } => 1 + item_type.transitive_dependency_count(),
            Self::Map {
                key_type,
                value_type,
            } => {
                2 + key_type.transitive_dependency_count()
                    + value_type.transitive_dependency_count()
            }
            Self::Complex(complex) => {
                1 + match complex {
                    ComplexType::Struct(s) => s
                        .fields
                        .values()
                        .map(|f| f.ty.transitive_dependency_count())
                        .sum(),
                    ComplexType::Union(u) => u
                        .types
                        .iter()
                        .map(|ty| ty.transitive_dependency_count())
                        .sum(),
                    ComplexType::Enum(_) => 0,
                }
            }
            Self::Foreign { target: _, name: _ } => 1,
        }
    }
/// Count how many other types this type (transitively) depends on,
/// including itself.
Count how many other types this type (transitively) depends on,
including itself.
Count how many other types this type ( transitively ) depends on including itself .
fn transitive_dependency_count(&self) -> usize {
        match self {
            Self::Primitive(_) => 0,
            Self::Tuple { item_types } => item_types
                .iter()
                .map(|i| 1 + i.transitive_dependency_count())
                .sum(),
            Self::List { item_type } => 1 + item_type.transitive_dependency_count(),
            Self::Map {
                key_type,
                value_type,
            } => {
                2 + key_type.transitive_dependency_count()
                    + value_type.transitive_dependency_count()
            }
            Self::Complex(complex) => {
                1 + match complex {
                    ComplexType::Struct(s) => s
                        .fields
                        .values()
                        .map(|f| f.ty.transitive_dependency_count())
                        .sum(),
                    ComplexType::Union(u) => u
                        .types
                        .iter()
                        .map(|ty| ty.transitive_dependency_count())
                        .sum(),
                    ComplexType::Enum(_) => 0,
                }
            }
            Self::Foreign { target: _, name: _ } => 1,
        }
    }
fn transitive_dependency_count ( & self ) -> usize { match self { Self :: Primitive ( _ ) => 0 , Self :: Tuple { item_types } => item_types . iter ( ) . map ( | i | 1 + i . transitive_dependency_count ( ) ) . sum ( ) , Self :: List { item_type } => 1 + item_type . transitive_dependency_count ( ) , Self :: Map { key_type , value_type , } => { 2 + key_type . transitive_dependency_count ( ) + value_type . transitive_dependency_count ( ) } Self :: Complex ( complex ) => { 1 + match complex { ComplexType :: Struct ( s ) => s . fields . values ( ) . map ( | f | f . ty . transitive_dependency_count ( ) ) . sum ( ) , ComplexType :: Union ( u ) => u . types . iter ( ) . map ( | ty | ty . transitive_dependency_count ( ) ) . sum ( ) , ComplexType :: Enum ( _ ) => 0 , } } Self :: Foreign { target : _ , name : _ } => 1 , } }
Count how many other types this type (transitively) depends on,
including itself.
Count how many other types this type ( transitively ) depends on including itself .
&self
&self