fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
    let mut out = Vec::new();
    let mut visited = FxHashSet::default();
    let mut work = VecDeque::new();

    work.push_back(first_ty);

    while let Some(ty) = work.pop_front() {
        if !visited.insert(ty.clone()) {
            continue;
        }

        match ty {
            clean::Type::ResolvedPath { did, .. } => {
                let get_extern = || cache.external_paths.get(&did).map(|s| s.0.clone());
                let fqp = cache.exact_paths.get(&did).cloned().or_else(get_extern);

                if let Some(path) = fqp {
                    out.push(path.join("::"));
                }
            }
            clean::Type::Tuple(tys) => {
                work.extend(tys.into_iter());
            }
            clean::Type::Slice(ty) => {
                work.push_back(*ty);
            }
            clean::Type::Array(ty, _) => {
                work.push_back(*ty);
            }
            clean::Type::RawPointer(_, ty) => {
                work.push_back(*ty);
            }
            clean::Type::BorrowedRef { type_, .. } => {
                work.push_back(*type_);
            }
            clean::Type::QPath { self_type, trait_, .. } => {
                work.push_back(*self_type);
                work.push_back(*trait_);
            }
            _ => {}
        }
    }
    out
}
/// Returns a list of all paths used in the type.
/// This is used to help deduplicate imported impls
/// for reexported types. If any of the contained
/// types are re-exported, we don't use the corresponding
/// entry from the js file, as inlining will have already
/// picked up the impl
Returns a list of all paths used in the type.
This is used to help deduplicate imported impls
for reexported types. If any of the contained
types are re-exported, we don't use the corresponding
entry from the js file, as inlining will have already
picked up the impl
Returns a list of all paths used in the type . This is used to help deduplicate imported impls for reexported types . If any of the contained types are re - exported we don ' t use the corresponding entry from the js file as inlining will have already picked up the impl
fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
    let mut out = Vec::new();
    let mut visited = FxHashSet::default();
    let mut work = VecDeque::new();
    work.push_back(first_ty);
    while let Some(ty) = work.pop_front() {
        if !visited.insert(ty.clone()) {
            continue;
        }
        match ty {
            clean::Type::ResolvedPath { did, .. } => {
                let get_extern = || cache.external_paths.get(&did).map(|s| s.0.clone());
                let fqp = cache.exact_paths.get(&did).cloned().or_else(get_extern);
                if let Some(path) = fqp {
                    out.push(path.join("::"));
                }
            }
            clean::Type::Tuple(tys) => {
                work.extend(tys.into_iter());
            }
            clean::Type::Slice(ty) => {
                work.push_back(*ty);
            }
            clean::Type::Array(ty, _) => {
                work.push_back(*ty);
            }
            clean::Type::RawPointer(_, ty) => {
                work.push_back(*ty);
            }
            clean::Type::BorrowedRef { type_, .. } => {
                work.push_back(*type_);
            }
            clean::Type::QPath { self_type, trait_, .. } => {
                work.push_back(*self_type);
                work.push_back(*trait_);
            }
            _ => {}
        }
    }
    out
}
fn collect_paths_for_type ( first_ty : clean :: Type , cache : & Cache ) -> Vec < String > { let mut out = Vec :: new ( ) ; let mut visited = FxHashSet :: default ( ) ; let mut work = VecDeque :: new ( ) ; work . push_back ( first_ty ) ; while let Some ( ty ) = work . pop_front ( ) { if ! visited . insert ( ty . clone ( ) ) { continue ; } match ty { clean :: Type :: ResolvedPath { did , .. } => { let get_extern = | | cache . external_paths . get ( & did ) . map ( | s | s . 0 . clone ( ) ) ; let fqp = cache . exact_paths . get ( & did ) . cloned ( ) . or_else ( get_extern ) ; if let Some ( path ) = fqp { out . push ( path . join ( " " ) ) ; } } clean :: Type :: Tuple ( tys ) => { work . extend ( tys . into_iter ( ) ) ; } clean :: Type :: Slice ( ty ) => { work . push_back ( * ty ) ; } clean :: Type :: Array ( ty , _ ) => { work . push_back ( * ty ) ; } clean :: Type :: RawPointer ( _ , ty ) => { work . push_back ( * ty ) ; } clean :: Type :: BorrowedRef { type_ , .. } => { work . push_back ( * type_ ) ; } clean :: Type :: QPath { self_type , trait_ , .. } => { work . push_back ( * self_type ) ; work . push_back ( * trait_ ) ; } _ => { } } } out }
Returns a list of all paths used in the type.
Returns a list of all paths used in the type .
first_ty
clean::Type
cache
&Cache
first_ty
clean::Type
cache
&Cache