pub fn load_glyph_set(input_path: &PathBuf) -> Result<GlyphSet, Box<dyn std::error::Error>> {
    use std::fs::File;
    use std::io::Read;
    let mut file = File::open(input_path)?;
    let mut content = String::new();
    file.read_to_string(&mut content)?;

    let extension = input_path.extension().expect("should have an extension");

    let mut p: GlyphSet;
    if extension == "json" {
        p = serde_json::from_str(&content)?;
    } else if extension == "yaml" {
        p = serde_yaml::from_str(&content)?;
    } else {
        return Err(Box::new(std::io::Error::new(
            std::io::ErrorKind::Other,
            "Unknown type",
        )));
    }
    p.prepare();
    Ok(p)
}
/// Load a glyph set from a json or yaml file.
Load a glyph set from a json or yaml file.
Load a glyph set from a json or yaml file .
pub fn load_glyph_set(input_path: &PathBuf) -> Result<GlyphSet, Box<dyn std::error::Error>> {
    use std::fs::File;
    use std::io::Read;
    let mut file = File::open(input_path)?;
    let mut content = String::new();
    file.read_to_string(&mut content)?;
    let extension = input_path.extension().expect("should have an extension");
    let mut p: GlyphSet;
    if extension == "json" {
        p = serde_json::from_str(&content)?;
    } else if extension == "yaml" {
        p = serde_yaml::from_str(&content)?;
    } else {
        return Err(Box::new(std::io::Error::new(
            std::io::ErrorKind::Other,
            "Unknown type",
        )));
    }
    p.prepare();
    Ok(p)
}
pub fn load_glyph_set ( input_path : & PathBuf ) -> Result < GlyphSet , Box < dyn std :: error :: Error > > { use std :: fs :: File ; use std :: io :: Read ; let mut file = File :: open ( input_path ) ? ; let mut content = String :: new ( ) ; file . read_to_string ( & mut content ) ? ; let extension = input_path . extension ( ) . expect ( " " ) ; let mut p : GlyphSet ; if extension == " " { p = serde_json :: from_str ( & content ) ? ; } else if extension == " " { p = serde_yaml :: from_str ( & content ) ? ; } else { return Err ( Box :: new ( std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , " " , ) ) ) ; } p . prepare ( ) ; Ok ( p ) }
Load a glyph set from a json or yaml file.
Load a glyph set from a json or yaml file .
input_path
&PathBuf