Trait libxivdat::high_level::Validate[][src]

pub trait Validate {
    fn validate(&self) -> Option<DATError>;
}
Expand description

Defines a high-level data struct that can be validated against a spec used by the game client.

Required methods

Validates the struct data against the spec expected by the game client. Returns a DATError describing the error if validation fails, or None if validation is successful.

Examples

use libxivdat::high_level::Validate;
use libxivdat::xiv_macro::Macro;

let a_macro = Macro {
    icon_id: "0000000".to_string(),
    icon_key: "000".to_string(),
    lines: vec![String::new(); 15],
    title: "Title".to_string()
};
assert!(a_macro.validate().is_none());
use libxivdat::high_level::Validate;
use libxivdat::xiv_macro::Macro;

let a_macro = Macro {
    icon_id: "123456".to_string(),
    icon_key: "XYZ".to_string(),
    lines: vec![String::new(); 1],
    title: "Looooooooooooooooong Title".to_string()
};
assert!(a_macro.validate().is_some());

Implementors