pub struct Scenario {
    pub versio: Token,
    /* private fields */
}

Fields

versio: Token

Implementations

Read scenario data from the given file. Please check the github homepage for the version support status. Generally, ver.1.46 and above are well supported.

Examples
use aoe2_probe::Scenario;
let scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario");

Read scenario data from the given little endian buffer.

Examples
use aoe2_probe::Scenario;
//Encode a scenario to a little endian vector of uint8
let source_scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario").unwrap();
let buffer = source_scenario.to_le_export_vec();

//Decode a scenario from a little endian vector of uint8
let scenario = Scenario::from_le_vec(buffer);

Encode a scenario struct to little endian vector of uint8 If you want to generate an .aoe2scenario file, then this function are not recommended. The whole .aoe2scenario except file header part are compressed. The bytes generated by this function are raw uncompressed. See function to_export_le_vec for compressed bytes.

Examples
use aoe2_probe::Scenario;
//Encode a scenario to a little endian vector of uint8
let source_scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario").unwrap();
let buffer = source_scenario.to_le_vec();

Encode a scenario struct to little endian vector of uint8 that can be read by AoE2 DE

Examples
use aoe2_probe::Scenario;
//Encode a scenario to a little endian vector of uint8
let source_scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario").unwrap();
let buffer = source_scenario.to_le_export_vec();

Save the given scenario to the given path. The path will be created if not existed.

Examples
use aoe2_probe::{Scenario, ExportFormat};
let source_scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario").unwrap();
let buffer = source_scenario.to_file("./resources/temp.aoe2scenario", ExportFormat::AoE2Scenario);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.