Trait libxivdat::high_level::AsBytes[][src]

pub trait AsBytes {
    fn as_bytes(&self) -> Result<Vec<u8>, DATError>;
}
Expand description

Defines a high-level data struct that can be represented as a writeable byte vector.

Required methods

Returns a byte vector representing the struct. This can then be written back to the DAT file on disk.

Errors

Returns a DATError::Overflow if the content of a data block would exceed the maximum allowable length.

Examples

use libxivdat::high_level::AsBytes;
use libxivdat::xiv_macro::Macro;
use libxivdat::xiv_macro::icon::MacroIcon;

let a_macro = Macro::new(
    "Title".to_string(),
    vec!["Circle".to_string()],
    MacroIcon::SymbolCircle
).unwrap();

let bytes = a_macro.as_bytes();
assert!(bytes.is_ok());

Implementors