Function rspolib::mofile

source ·
pub fn mofile<Opt>(options: Opt) -> Result<MOFile, IOError>where
    Opt: Into<FileOptions>,
Expand description

MO file factory function

Read a MO file from a path, parse from content as bytes or from a FileOptions struct.

Examples

Read a MO file from a path

use rspolib::mofile;

let file = mofile("tests-data/all.mo").unwrap();
assert_eq!(file.entries.len(), 7);

Read a MO file from bytes

use rspolib::mofile;

let bytes = std::fs::read("tests-data/all.mo").unwrap();
let file = mofile(bytes).unwrap();
assert_eq!(file.entries.len(), 7);