Function libxivdat::xiv_macro::as_writeable_bytes_unsafe[][src]

pub fn as_writeable_bytes_unsafe(
    macros: &[MacroData<'_>]
) -> Result<Vec<u8>, DATError>
Expand description

Returns a byte vector representing a slice of MacroData. 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::{as_writeable_bytes_unsafe, MacroData};
use libxivdat::xiv_macro::icon::MacroIcon;

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