pub fn parse_file(svg_path: &Path, units: Units, dpi: f32) -> Result<SvgImage, Error> {
    let file = File::open(svg_path)?;
    let mut buf_reader = BufReader::new(file);
    let mut contents = Vec::new();
    buf_reader.read_to_end(&mut contents)?;

    let svg_c_string = CString::new(contents)?.into_raw();

    let image = unsafe {
      let image = bindings::nsvgParse(svg_c_string, units.as_c_str(), dpi);
      CString::from_raw(svg_c_string);
      image
    };

    if image.is_null() {
      Err(Error::ParseError)
    } else {
      Ok(SvgImage { image })
    }
  }
/**
   * Loads SVG data from a file at the given `Path`.
   *
   * # Arguments
   * - `svg_path` - Path to the SVG you want to load
   * - `units` - The length unit identifier, you probably just want `nsvg::Units::Pixel`
   * - `dpi` - Probably just want `96.0`.
   */
Loads SVG data from a file at the given `Path`.
Loads SVG data from a file at the given ` Path ` .
pub fn parse_file(svg_path: &Path, units: Units, dpi: f32) -> Result<SvgImage, Error> {
    let file = File::open(svg_path)?;
    let mut buf_reader = BufReader::new(file);
    let mut contents = Vec::new();
    buf_reader.read_to_end(&mut contents)?;
    let svg_c_string = CString::new(contents)?.into_raw();
    let image = unsafe {
      let image = bindings::nsvgParse(svg_c_string, units.as_c_str(), dpi);
      CString::from_raw(svg_c_string);
      image
    };
    if image.is_null() {
      Err(Error::ParseError)
    } else {
      Ok(SvgImage { image })
    }
  }
pub fn parse_file ( svg_path : & Path , units : Units , dpi : f32 ) -> Result < SvgImage , Error > { let file = File :: open ( svg_path ) ? ; let mut buf_reader = BufReader :: new ( file ) ; let mut contents = Vec :: new ( ) ; buf_reader . read_to_end ( & mut contents ) ? ; let svg_c_string = CString :: new ( contents ) ? . into_raw ( ) ; let image = unsafe { let image = bindings :: nsvgParse ( svg_c_string , units . as_c_str ( ) , dpi ) ; CString :: from_raw ( svg_c_string ) ; image } ; if image . is_null ( ) { Err ( Error :: ParseError ) } else { Ok ( SvgImage { image } ) } }
Loads SVG data from a file at the given `Path`.
Loads SVG data from a file at the given ` Path ` .
svg_path
&Path
units
Units
dpi
f32