Function libxivdat::xiv_macro::to_writeable_bytes_unsafe[][src]

pub fn to_writeable_bytes_unsafe(macros: &[Macro]) -> Result<Vec<u8>, DATError>
Expand description

Returns a byte vector representing a slice of Macros. This can then be written back to a a file using write_content().

Errors

Returns DATError::Overflow if a macro data section would exceed the maximum possible size for that section type.

Examples

use libxivdat::xiv_macro::{to_writeable_bytes_unsafe, Macro};
use libxivdat::xiv_macro::icon::MacroIcon;

let macro_vec = vec![Macro::new("Title".to_owned(), vec!["line".to_owned(); 15], MacroIcon::DefaultIcon).unwrap(); 100];
let macro_bytes = to_writeable_bytes_unsafe(&macro_vec);
assert!(macro_bytes.is_ok());