fn search_source(path: String, dbpath: String) {
    log::info!("Searching {} for comments", path);

    let pool = ThreadPool::new(num_cpus::get());
    let (tx, rx) = channel();

    for e in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) {
        let metadata = e.metadata().unwrap();
        let path = e.path();
        if metadata.is_file() {
            let extension = path.extension();

            if Some(OsStr::new("c")) == extension
                || Some(OsStr::new("cpp")) == extension
                || Some(OsStr::new("cxx")) == extension
                || Some(OsStr::new("h")) == extension
                || Some(OsStr::new("rs")) == extension
            {
                let p = path.to_owned();
                let tx = tx.clone();

                pool.execute(move || {
                    let filedata = get_comments(p);
                    tx.send(filedata).expect("Could not send data!");
                });
            }
        }
    }

    drop(tx);

    let mut datas = Vec::<FileData>::new();
    for t in rx.iter() {
        let filedata = t;
        datas.push(filedata);
    }

    write_to_db(datas, dbpath);
}
/*
    For a given path and sqlite connection
    This will walk the given path and then look for comments in every file with an extension of (.c,.cpp,.cxx,.h,.rs).
    Comments are then store in the sqlite db
*/
For a given path and sqlite connection
This will walk the given path and then look for comments in every file with an extension of (.c,.cpp,.cxx,.h,.rs).
Comments are then store in the sqlite db
For a given path and sqlite connection This will walk the given path and then look for comments in every file with an extension of ( . c . cpp . cxx . h . rs ) . Comments are then store in the sqlite db
fn search_source(path: String, dbpath: String) {
    log::info!("Searching {} for comments", path);
    let pool = ThreadPool::new(num_cpus::get());
    let (tx, rx) = channel();
    for e in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) {
        let metadata = e.metadata().unwrap();
        let path = e.path();
        if metadata.is_file() {
            let extension = path.extension();
            if Some(OsStr::new("c")) == extension
                || Some(OsStr::new("cpp")) == extension
                || Some(OsStr::new("cxx")) == extension
                || Some(OsStr::new("h")) == extension
                || Some(OsStr::new("rs")) == extension
            {
                let p = path.to_owned();
                let tx = tx.clone();
                pool.execute(move || {
                    let filedata = get_comments(p);
                    tx.send(filedata).expect("Could not send data!");
                });
            }
        }
    }
    drop(tx);
    let mut datas = Vec::<FileData>::new();
    for t in rx.iter() {
        let filedata = t;
        datas.push(filedata);
    }
    write_to_db(datas, dbpath);
}
fn search_source ( path : String , dbpath : String ) { log :: info ! ( " " path ) ; let pool = ThreadPool :: new ( num_cpus :: get ( ) ) ; let ( tx , rx ) = channel ( ) ; for e in WalkDir :: new ( path ) . into_iter ( ) . filter_map ( | e | e . ok ( ) ) { let metadata = e . metadata ( ) . unwrap ( ) ; let path = e . path ( ) ; if metadata . is_file ( ) { let extension = path . extension ( ) ; if Some ( OsStr :: new ( " " ) ) == extension || Some ( OsStr :: new ( " " ) ) == extension || Some ( OsStr :: new ( " " ) ) == extension || Some ( OsStr :: new ( " " ) ) == extension || Some ( OsStr :: new ( " " ) ) == extension { let p = path . to_owned ( ) ; let tx = tx . clone ( ) ; pool . execute ( move | | { let filedata = get_comments ( p ) ; tx . send ( filedata ) . expect ( " " ) ; } ) ; } } } drop ( tx ) ; let mut datas = Vec :: < FileData > :: new ( ) ; for t in rx . iter ( ) { let filedata = t ; datas . push ( filedata ) ; } write_to_db ( datas , dbpath ) ; }
For a given path and sqlite connection
This will walk the given path and then look for comments in every file with an extension of (.c,.cpp,.cxx,.h,.rs).
For a given path and sqlite connection This will walk the given path and then look for comments in every file with an extension of ( . c . cpp . cxx . h . rs ) .
path
String
dbpath
String
path
String
dbpath
String