fn ast_map(files: Vec<ast::File>) -> ASTPackageMap {
    files
        .into_iter()
        .fold(ASTPackageMap::new(), |mut acc, file| {
            let path = file.name.rsplitn(2, '/').collect::<Vec<&str>>()[1].to_string();
            acc.insert(
                path.clone(),
                ast::Package {
                    base: ast::BaseNode {
                        ..ast::BaseNode::default()
                    },
                    path,
                    package: String::from(file.get_package()),
                    files: vec![file],
                },
            );
            acc
        })
}
// Associates an import path with each file
Associates an import path with each file
Associates an import path with each file
fn ast_map(files: Vec<ast::File>) -> ASTPackageMap {
    files
        .into_iter()
        .fold(ASTPackageMap::new(), |mut acc, file| {
            let path = file.name.rsplitn(2, '/').collect::<Vec<&str>>()[1].to_string();
            acc.insert(
                path.clone(),
                ast::Package {
                    base: ast::BaseNode {
                        ..ast::BaseNode::default()
                    },
                    path,
                    package: String::from(file.get_package()),
                    files: vec![file],
                },
            );
            acc
        })
}
fn ast_map ( files : Vec < ast :: File > ) -> ASTPackageMap { files . into_iter ( ) . fold ( ASTPackageMap :: new ( ) , | mut acc , file | { let path = file . name . rsplitn ( 2 , '/' ) . collect :: < Vec < & str > > ( ) [ 1 ] . to_string ( ) ; acc . insert ( path . clone ( ) , ast :: Package { base : ast :: BaseNode { .. ast :: BaseNode :: default ( ) } , path , package : String :: from ( file . get_package ( ) ) , files : vec ! [ file ] , } , ) ; acc } ) }
Associates an import path with each file
Associates an import path with each file
files
Vec<ast::File>
files
Vec<ast::File>