Function libxivdat::xiv_macro::read_macro_unsafe [−][src]
pub fn read_macro_unsafe(dat_file: &mut DATFile) -> Result<Macro, DATError>
Expand description
Reads the next Macro
from a DATFile
. This does not check that the target
file is a macro file.
Errors
If an I/O error occurs while reading the file, a DATError::FileIO
error will be returned wrapping the underlying FS error.
If the macro title or lines do not contain valid utf-8, a DATError::BadEncoding
error will be returned.
Examples
use libxivdat::dat_file::DATFile; use libxivdat::xiv_macro::read_macro_unsafe; use libxivdat::xiv_macro::icon::MacroIcon; let mut dat_file = DATFile::open("./resources/TEST_MACRO.DAT").unwrap(); let a_macro = read_macro_unsafe(&mut dat_file).unwrap(); assert_eq!(a_macro.title, "0"); assert_eq!(a_macro.lines[0], "DefaultIcon"); assert_eq!(a_macro.get_icon().unwrap(), MacroIcon::DefaultIcon);