fn generate_for_dir<D>(dir: D, templates_dir: &str) -> Option<Vec<dependency::File>> where D: AsRef<Path> {
    let mut dependencies: Vec<dependency::File> = Vec::new();
    match fs::read_dir(&dir) {
        Ok(dir_contents) => {
            for file in dir_contents {
                let file = file.as_ref().expect(&format!("Error reading {:?}", &file))
                    .path();
                if file.is_dir() {
                    let mut _dependencies = generate_for_dir(&file, templates_dir);
                    if _dependencies.is_some() {
                        dependencies.append(unsafe { &mut _dependencies.unwrap_unchecked() });
                    }
                } else {
                    let file_dependencies = generate_for_file(&file, templates_dir);
                    dependencies.push(file_dependencies);
                };
            }
        }
        _ => {
            return None
        }
    }
    return if dependencies.is_empty() { None } else { Some(dependencies) }
}
/// Generate for all files in a `html` dir
Generate for all files in a `html` dir
Generate for all files in a ` html ` dir
fn generate_for_dir<D>(dir: D, templates_dir: &str) -> Option<Vec<dependency::File>> where D: AsRef<Path> {
    let mut dependencies: Vec<dependency::File> = Vec::new();
    match fs::read_dir(&dir) {
        Ok(dir_contents) => {
            for file in dir_contents {
                let file = file.as_ref().expect(&format!("Error reading {:?}", &file))
                    .path();
                if file.is_dir() {
                    let mut _dependencies = generate_for_dir(&file, templates_dir);
                    if _dependencies.is_some() {
                        dependencies.append(unsafe { &mut _dependencies.unwrap_unchecked() });
                    }
                } else {
                    let file_dependencies = generate_for_file(&file, templates_dir);
                    dependencies.push(file_dependencies);
                };
            }
        }
        _ => {
            return None
        }
    }
    return if dependencies.is_empty() { None } else { Some(dependencies) }
}
fn generate_for_dir < D > ( dir : D , templates_dir : & str ) -> Option < Vec < dependency :: File > > where D : AsRef < Path > { let mut dependencies : Vec < dependency :: File > = Vec :: new ( ) ; match fs :: read_dir ( & dir ) { Ok ( dir_contents ) => { for file in dir_contents { let file = file . as_ref ( ) . expect ( & format ! ( " " file ) ) . path ( ) ; if file . is_dir ( ) { let mut _dependencies = generate_for_dir ( & file , templates_dir ) ; if _dependencies . is_some ( ) { dependencies . append ( unsafe { & mut _dependencies . unwrap_unchecked ( ) } ) ; } } else { let file_dependencies = generate_for_file ( & file , templates_dir ) ; dependencies . push ( file_dependencies ) ; } ; } } _ => { return None } } return if dependencies . is_empty ( ) { None } else { Some ( dependencies ) } }
Generate for all files in a `html` dir
Generate for all files in a ` html ` dir
dir
D
templates_dir
&str
dir
D
templates_dir
&str