/// If you have a known filename, it is always preferable to call this function, as it sets the
/// filename on the Glif<PD> as well as on its GlifComponent's, easing their transition into
/// Component's.
If you have a known filename, it is always preferable to call this function, as it sets the
filename on the Glif as well as on its GlifComponent's, easing their transition into
Component's.
If you have a known filename it is always preferable to call this function as it sets the filename on the Glif as well as on its GlifComponent ' s easing their transition into Component ' s .
pub fn read_ufo_glif_from_filename<F: AsRef<Path> + Clone, PD: PointData>(filename: F) -> Result<Glif<PD>, GlifParserError> {
    let glifxml = match fs::read_to_string(&filename) {
        Ok(s) => s,
        Err(ioe) => Err(GlifParserError::GlifFileIoError(Some(Rc::new(ioe))))?
    };
    let mut glif: Glif<PD> = read_ufo_glif(&glifxml)?;
    let filenamepb = filename.as_ref().to_path_buf();
    for component in glif.components.vec.iter_mut() {
        component.set_file_name(&filenamepb);
    }
    glif.filename = Some(filenamepb);
    Ok(glif)
}
pub fn read_ufo_glif_from_filename < F : AsRef < Path > + Clone , PD : PointData > ( filename : F ) -> Result < Glif < PD > , GlifParserError > { let glifxml = match fs :: read_to_string ( & filename ) { Ok ( s ) => s , Err ( ioe ) => Err ( GlifParserError :: GlifFileIoError ( Some ( Rc :: new ( ioe ) ) ) ) ? } ; let mut glif : Glif < PD > = read_ufo_glif ( & glifxml ) ? ; let filenamepb = filename . as_ref ( ) . to_path_buf ( ) ; for component in glif . components . vec . iter_mut ( ) { component . set_file_name ( & filenamepb ) ; } glif . filename = Some ( filenamepb ) ; Ok ( glif ) }
If you have a known filename, it is always preferable to call this function, as it sets the
filename on the Glif<PD> as well as on its GlifComponent's, easing their transition into
Component's.
If you have a known filename it is always preferable to call this function as it sets the filename on the Glif<PD > as well as on its GlifComponent ' s easing their transition into Component ' s .
filename
F