/// Load all certificate files conained within a given directory structure.
Load all certificate files conained within a given directory structure.
Load all certificate files conained within a given directory structure .
fn load_ca_certificate_dir<P>(
    ssl_context: &mut SslContext,
    path: P) -> Result<(), RuntimeError>
    where P: AsRef<Path> {
    let path = path.as_ref();
    let dir  = try!(path.read_dir()
        .map_err(|err| RuntimeError::from(format!("{}", err))));
    for entry in dir {
        let entry = try!(entry.map_err(|err|
            RuntimeError::from(format!("{}", err))));
        let path = entry.path();
        if path.is_dir() {
            try!(load_ca_certificate_dir(ssl_context, &path));
        } else if is_cert_file(&path) {
            try!(ssl_context.set_CA_file(&path)
                .map_err(|err| RuntimeError::from(format!("{}", err))));
        }
    }
    Ok(())
}
fn load_ca_certificate_dir < P > ( ssl_context : & mut SslContext , path : P ) -> Result < ( ) , RuntimeError > where P : AsRef < Path > { let path = path . as_ref ( ) ; let dir = try ! ( path read_dir ( ) map_err ( err RuntimeError from ( format ( " " err ) ) ) ) ; for entry in dir { let entry = try ! ( entry map_err ( err RuntimeError from ( format ( " " err ) ) ) ) ; let path = entry . path ( ) ; if path . is_dir ( ) { try ! ( load_ca_certificate_dir ( ssl_context path ) ) ; } else if is_cert_file ( & path ) { try ! ( ssl_context set_CA_file ( path ) map_err ( err RuntimeError from ( format ( " " err ) ) ) ) ; } } Ok ( ( ) ) }
Load all certificate files conained within a given directory structure.
Load all certificate files conained within a given directory structure .
ssl_context
&mut SslContext
path
P