### PlayerInit Struct Fields Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Lists all fields of the PlayerInit struct with their types and descriptions as documented in the source. ```APIDOC ## PlayerInit Struct ### Description Represents player initialization data in an Age of Empires II recorded game header. ### Fields - **civilization** (DeString) - The player's civilization. - **game_status** (u8) - The game status. - **resigned** (Bool) - Indicates if the player resigned. - **player_color** (u8) - The player's color. - **sep1** (u8) - Separator byte. - **unknown3** (u8) - Unknown field. - **unknown4** ([u32; 8]) - Unknown array of 8 u32 values. - **unknown5** (f32) - Unknown float value. - **unknown6** (Vec) - Unknown vector of bytes. - **unknown_struct** (UnknownPlayerStruct) - Unknown nested structure. - **dev** ([u32; 20]) - Development field array of 20 u32 values. - **dev1** ([u32; 20]) - Development field array of 20 u32 values. - **dev2** ([u32; 20]) - Development field array of 20 u32 values. - **dev3** ([i32; 20]) - Development field array of 20 i32 values. - **dev4** ([i32; 20]) - Development field array of 20 i32 values. - **dev5** ([i32; 20]) - Development field array of 20 i32 values. - **dev6** ([i32; 20]) - Development field array of 20 i32 values. - **dev7** ([i32; 20]) - Development field array of 20 i32 values. ``` -------------------------------- ### impl Any for T Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/enum.AIConfig.html Provides the type_id method to get the TypeId of the value. ```APIDOC ## impl Any for T ### Description Provides the `type_id` method to get the `TypeId` of the value. ### Method `fn type_id(&self) -> TypeId` ### Parameters - `&self` - The value to get the type ID of. ### Returns - `TypeId` - The `TypeId` of `self`. ``` -------------------------------- ### PlayerInit struct with binrw and serde attributes Source: https://docs.rs/aoe2rec/latest/src/aoe2rec/header/mod.rs.html Defines the PlayerInit struct for parsing player initialization data. Uses binrw attributes for binary reading, including conditional fields based on major/minor version, magic bytes, and counts. Serde skip_serializing is used for unknown fields. Includes several TODO fields for unimplemented data. ```rust #[derive(Serialize, Debug)] #[br(import(num_players: u8, major: u16, minor: u16))] pub struct PlayerInit { pub player_type: u8, #[serde(skip_serializing)] pub unknown1: u8, #[serde(skip_serializing)] #[br(count = num_players)] pub their_diplomacy: Vec, #[br(count = num_players)] pub own_diplomacy: Vec, pub allied_los: u32, pub allied_victory: Bool, pub player_name: LenString16, #[br(magic = b"\x16")] pub header_data_count: i32, #[br(magic = b"\x21")] #[br(count=header_data_count)] pub player_stats: Vec, #[br(count=header_data_count)] pub extra_player_stats: Vec, pub padding: u8, pub view: PlayerView, pub saved_views_count: i32, #[br(count = if saved_views_count < 0 { 0 } else { saved_views_count })] pub saved_views: Vec, pub spawn_location: Location, pub culture: u8, #[br(if(major >= 67))] pub name: DeString, pub civilization: u8, pub game_status: u8, #[br(pad_after = 1)] pub resigned: Bool, #[br(pad_after = 1)] pub player_color: u8, #[serde(skip_serializing)] #[br(if(major < 67))] pub sep1: u8, #[serde(skip_serializing)] #[br(magic = b"\x0B")] pub unknown3: u8, #[serde(skip_serializing)] #[br(magic = b"\x0B")] pub unknown4: [u32; 8], #[serde(skip_serializing)] pub unknown5: f32, #[serde(skip_serializing)] #[br(count = 197)] pub unknown6: Vec, #[serde(skip_serializing)] #[br(args(major, minor))] pub unknown_struct: UnknownPlayerStruct, pub dev: [u32; 20], // TODO: Finish implementing pub dev1: [u32; 20], // TODO: Finish implementing pub dev2: [u32; 20], // TODO: Finish implementing pub dev3: [i32; 20], // TODO: Finish implementing pub dev4: [i32; 20], // TODO: Finish implementing pub dev5: [i32; 20], // TODO: Finish implementing pub dev6: [i32; 20], // TODO: Finish implementing pub dev7: [i32; 20], // TODO: Finish implementing } ``` -------------------------------- ### impl Any for T Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.UnknownPlayerStruct.html Blanket implementation of the Any trait for all types, including UnknownPlayerStruct. Provides the type_id method to get the TypeId of the value. ```APIDOC ## impl Any for T ### Description Provides the `type_id` method to get the `TypeId` of the value. ### Method `type_id` ### Signature `fn type_id(&self) -> TypeId` ### Parameters - `&self` - The value to get the type ID of. ### Returns - `TypeId` - The `TypeId` of the value. ``` -------------------------------- ### Calculate Game Duration from Operations Source: https://docs.rs/aoe2rec/latest/src/aoe2rec/lib.rs.html Computes the total game duration by starting with the initial world time and adding `time_increment` for each `Operation::Sync`. Returns the duration as a `u32`. ```rust pub fn get_duration(&self) -> u32 { self.chapters[0].operations.iter().fold( self.chapters[0].zheader.replay.world_time, |duration, operation| match operation { Operation::Sync { time_increment, .. } => duration + time_increment, _ => duration, }, ) } ``` -------------------------------- ### write_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Writes the MinimalGameSettings struct to a writer using the given arguments. This method is part of the binrw BinWrite trait implementation. ```APIDOC ## write_args ### Description Writes `Self` to the writer using the given arguments. ### Method `fn write_args(&self, writer: &mut W, args: Self::Args<'a>) -> Result<(), Error>` ### Parameters - `writer` (`&mut W`) - Required - The writer to write to. Must implement `Write + Seek`. - `args` (`Self::Args<'a>`) - Required - The arguments to use for writing. ### Return Value `Result<(), Error>` - Returns `Ok(())` on success, or an `Error` on failure. ### Constraints - `W: Write + Seek` - `Self: WriteEndian` ``` -------------------------------- ### Build Savegame Summary Source: https://docs.rs/aoe2rec/latest/src/aoe2rec/lib.rs.html Constructs a `SavegameSummary` containing header information, duration, resignations, and teams derived from the savegame. Uses references to the first chapter's header data. ```rust pub fn get_summary(&self) -> summary::SavegameSummary<'_> { summary::SavegameSummary { header: summary::SummaryHeader { game: &self.chapters[0].zheader.game, version_minor: self.chapters[0].zheader.version_minor, version_major: self.chapters[0].zheader.version_major, build: self.chapters[0].zheader.build, timestamp: self.chapters[0].zheader.timestamp, game_settings: &self.chapters[0].zheader.game_settings, replay: &self.chapters[0].zheader.replay, }, duration: self.get_duration(), resignations: self.get_resignations(), teams: GameTeam::from_savegame(self), } } ``` -------------------------------- ### read_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Reads MinimalGameSettings from a reader using the given arguments. This method is part of the BinRead trait implementation. ```APIDOC ## read_args ### Description Reads `Self` from the reader using the given arguments. ### Method `fn read_args(reader: &mut R, args: Self::Args<'_>) -> Result` ### Parameters - `reader` (`&mut R`) - Required - The reader to read from. - `args` (`Self::Args<'_>`) - Required - The arguments for reading. ### Constraints - `R: Read + Seek` - `Self: ReadEndian` ### Return Value - `Result` - The parsed struct or an error. ``` -------------------------------- ### BinWrite::write_options Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Writes a PlayerInit to a writer using the given endianness and arguments. ```APIDOC ## BinWrite::write_options ### Description Writes the PlayerInit to the writer using the given `Endian` and arguments. ### Method write_options ### Signature ```rust fn write_options( &self, writer: &mut W, endian: Endian, arguments: Self::Args<'_>, ) -> BinResult<()>; ``` ### Parameters - **writer** (`&mut W`) - The writer to write to. Must implement `Write` and `Seek`. - **endian** (`Endian`) - The endianness to use. - **arguments** (`Self::Args<'_>`) - The arguments for writing. ### Return Value - `BinResult<()>` - Success or an error. ``` -------------------------------- ### write Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Writes the MinimalGameSettings struct to a writer using default arguments. The writer must implement both Write and Seek, and the struct must implement WriteEndian with required arguments. ```APIDOC ## write ### Description Writes `Self` to the writer using default arguments. ### Method write ### Signature `fn write(&self, writer: &mut W) -> Result<(), Error>` where W: Write + Seek, Self: WriteEndian, Self::Args<'a>: for<'a> Required ### Parameters - **writer** (`&mut W`) - Required - The writer to write the struct to. Must implement `Write` and `Seek`. ### Return Value - `Result<(), Error>` - Success or a binrw error. ### Source [Source](https://docs.rs/binrw/0.15.2/x86_64-unknown-linux-gnu/src/binrw/binwrite/mod.rs.html#69-71) ``` -------------------------------- ### read_be_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Reads MinimalGameSettings from a reader assuming big-endian byte order, using the given arguments. ```APIDOC ## read_be_args ### Description Reads `Self` from the reader, assuming big-endian byte order, using the given arguments. ### Method `fn read_be_args(reader: &mut R, args: Self::Args<'_>) -> Result` ### Parameters - `reader` (`&mut R`) - Required - The reader to read from. - `args` (`Self::Args<'_>`) - Required - The arguments for reading. ### Constraints - `R: Read + Seek` ### Return Value - `Result` - The parsed struct or an error. ``` -------------------------------- ### read_le Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Reads the MinimalGameSettings from a reader using default arguments and assuming little-endian byte order. ```APIDOC ## read_le ### Description Reads the MinimalGameSettings from a reader using default arguments and assuming little-endian byte order. ### Method read_le ### Signature ```rust fn read_le(reader: &mut R) -> Result where R: Read + Seek, Self::Args<'a>: for<'a> Required, ``` ### Parameters - **reader** (`&mut R`) - Required - The reader to read from. Must implement `Read` and `Seek`. ### Return Value - `Result` - The parsed `MinimalGameSettings` or an error. ``` -------------------------------- ### write_le_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Writes the MinimalGameSettings to a writer using little-endian byte order with the given arguments. ```APIDOC ## write_le_args ### Description Writes `Self` to the writer, assuming little-endian byte order, using the given arguments. ### Method `write_le_args` ### Signature ```rust fn write_le_args(&self, writer: &mut W, args: Self::Args<'_>) -> Result<(), Error> where W: Write + Seek, ``` ### Parameters - `writer` (`&mut W`) - Required - The writer to write to. - `args` (`Self::Args<'_>`) - Required - The arguments for writing. ### Return Value - `Result<(), Error>` - Returns `Ok(())` on success, or an `Error` on failure. ``` -------------------------------- ### write_le Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Writes the MinimalGameSettings struct to a writer assuming little-endian byte order. The writer must implement both Write and Seek, and the struct's arguments must be required. ```APIDOC ## write_le ### Description Write `Self` to the writer assuming little-endian byte order. ### Method write_le ### Signature `fn write_le(&self, writer: &mut W) -> Result<(), Error>` where W: Write + Seek, Self::Args<'a>: for<'a> Required ### Parameters - **writer** (`&mut W`) - Required - The writer to write the struct to. Must implement `Write` and `Seek`. ### Return Value - `Result<(), Error>` - Success or a binrw error. ### Source [Source](https://docs.rs/binrw/0.15.2/x86_64-unknown-linux-gnu/src/binrw/binwrite/mod.rs.html#95-97) ``` -------------------------------- ### ActionData::Build Source: https://docs.rs/aoe2rec/latest/aoe2rec/actions/enum.ActionData.html Represents a build action. Contains the player ID, action length, and raw data bytes. ```APIDOC ## ActionData::Build ### Description Represents a build action in the game. Contains the player ID, action length, and raw data bytes. ### Fields - **player_id** (u8) - The ID of the player performing the action. - **action_length** (u16) - The length of the action data. - **data** (Vec) - Raw data associated with the action. ``` -------------------------------- ### write_le_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Writes the PlayerInit struct to a writer using little-endian byte order with the given arguments. ```APIDOC ## write_le_args ### Description Writes `Self` to the writer, assuming little-endian byte order, using the given arguments. ### Method write_le_args ### Signature ```rust fn write_le_args(&self, writer: &mut W, args: Self::Args<'_>) -> Result<(), Error> where W: Write + Seek ``` ### Parameters - **writer** (`&mut W`) - Required - The writer to write the data to. - **args** (`Self::Args<'_>`) - Required - The arguments for writing. ### Return Value - `Result<(), Error>` - Success or an error during writing. ### Constraints - `W` must implement `Write` and `Seek` traits. ``` -------------------------------- ### read_be Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Reads the MinimalGameSettings from a reader using default arguments and assuming big-endian byte order. ```APIDOC ## read_be ### Description Reads the MinimalGameSettings from a reader using default arguments and assuming big-endian byte order. ### Method read_be ### Signature ```rust fn read_be(reader: &mut R) -> Result where R: Read + Seek, Self::Args<'a>: for<'a> Required, ``` ### Parameters - **reader** (`&mut R`) - Required - The reader to read from. Must implement `Read` and `Seek`. ### Return Value - `Result` - The parsed `MinimalGameSettings` or an error. ``` -------------------------------- ### write_ne_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Writes the MinimalGameSettings to a writer using native-endian byte order with the given arguments. ```APIDOC ## write_ne_args ### Description Writes `Self` to the writer, assuming native-endian byte order, using the given arguments. ### Method `write_ne_args` ### Signature ```rust fn write_ne_args(&self, writer: &mut W, args: Self::Args<'_>) -> Result<(), Error> where W: Write + Seek, ``` ### Parameters - `writer` (`&mut W`) - Required - The writer to write to. - `args` (`Self::Args<'_>`) - Required - The arguments for writing. ### Return Value - `Result<(), Error>` - Returns `Ok(())` on success, or an `Error` on failure. ``` -------------------------------- ### ActionData::Create Source: https://docs.rs/aoe2rec/latest/aoe2rec/actions/enum.ActionData.html Represents a create action in the game. Contains player ID, action length, and raw data. ```APIDOC ## ActionData::Create ### Description Represents a create action in the game. Contains player ID, action length, and raw data. ### Variant Fields - `player_id` (u8) - The ID of the player performing the action. - `action_length` (u16) - The length of the action. - `data` (Vec) - Raw data associated with the action. ``` -------------------------------- ### write Source: https://docs.rs/aoe2rec/latest/aoe2rec/struct.SyncOperation.html Writes the SyncOperation to a writer using default arguments. ```APIDOC ## write ### Description Writes `Self` to the writer using default arguments. ### Method `fn write(&self, writer: &mut W) -> Result<(), Error>` ### Parameters - **writer** (`&mut W`) - Required - The writer to write to. ### Return Value - `Result<(), Error>` - Result indicating success or failure. ``` -------------------------------- ### write_options Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.GameSettings.html Writes the GameSettings struct to a writer using the specified endianness and arguments. This is the core method for binary serialization. ```APIDOC ## write_options ### Description Writes `Self` to the writer using the given `Endian` and arguments. ### Method write_options ### Signature ```rust fn write_options( &self, __binrw_generated_var_writer: &mut W, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<()> ``` ### Parameters - **writer** (`&mut W`) - Required - The writer to write to. - **endian** (`Endian`) - Required - The endianness to use. - **arguments** (`Self::Args<'_>`) - Required - The arguments for writing. ### Returns - `BinResult<()>` - Result indicating success or failure. ``` -------------------------------- ### impl Serialize for PlayerInit Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Implements the serde Serialize trait for the PlayerInit struct, allowing it to be serialized using Serde serializers. ```APIDOC ## impl Serialize for PlayerInit ### Description Implements the `Serialize` trait for the `PlayerInit` struct, enabling serialization via Serde. ### Method `serialize` ### Signature ```rust fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer, ``` ### Parameters - `&self` - Reference to the `PlayerInit` instance. - `__serializer` (Serializer) - The Serde serializer to use. ### Return Value - `Result<__S::Ok, __S::Error>` - The serialized output or an error. ### Auto Trait Implementations - `Freeze` - `RefUnwindSafe` - `Send` - `Sync` - `Unpin` - `UnsafeUnpin` - `UnwindSafe` ``` -------------------------------- ### read_ne Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Reads the MinimalGameSettings from a reader using default arguments and assuming native-endian byte order. ```APIDOC ## read_ne ### Description Reads the MinimalGameSettings from a reader using default arguments and assuming native-endian byte order. ### Method read_ne ### Signature ```rust fn read_ne(reader: &mut R) -> Result where R: Read + Seek, Self::Args<'a>: for<'a> Required, ``` ### Parameters - **reader** (`&mut R`) - Required - The reader to read from. Must implement `Read` and `Seek`. ### Return Value - `Result` - The parsed `MinimalGameSettings` or an error. ``` -------------------------------- ### write_be_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Writes the PlayerInit struct to a writer using big-endian byte order with the given arguments. ```APIDOC ## write_be_args ### Description Writes `Self` to the writer, assuming big-endian byte order, using the given arguments. ### Method write_be_args ### Signature ```rust fn write_be_args(&self, writer: &mut W, args: Self::Args<'_>) -> Result<(), Error> where W: Write + Seek ``` ### Parameters - **writer** (`&mut W`) - Required - The writer to write the data to. - **args** (`Self::Args<'_>`) - Required - The arguments for writing. ### Return Value - `Result<(), Error>` - Success or an error during writing. ### Constraints - `W` must implement `Write` and `Seek` traits. ``` -------------------------------- ### write_le_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Writes the MinimalGameSettings struct to a writer using little-endian byte order and the given arguments. This method is part of the binrw BinWrite trait implementation. ```APIDOC ## write_le_args ### Description Writes `Self` to the writer, assuming little-endian byte order, using the given arguments. ### Method `fn write_le_args(&self, writer: &mut W, args: Self::Args<'a>) -> Result<(), Error>` ### Parameters - `writer` (`&mut W`) - Required - The writer to write to. Must implement `Write + Seek`. - `args` (`Self::Args<'a>`) - Required - The arguments to use for writing. ### Return Value `Result<(), Error>` - Returns `Ok(())` on success, or an `Error` on failure. ### Constraints - `W: Write + Seek` ``` -------------------------------- ### write_be Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Writes the MinimalGameSettings struct to a writer assuming big-endian byte order. The writer must implement both Write and Seek, and the struct's arguments must be required. ```APIDOC ## write_be ### Description Write `Self` to the writer assuming big-endian byte order. ### Method write_be ### Signature `fn write_be(&self, writer: &mut W) -> Result<(), Error>` where W: Write + Seek, Self::Args<'a>: for<'a> Required ### Parameters - **writer** (`&mut W`) - Required - The writer to write the struct to. Must implement `Write` and `Seek`. ### Return Value - `Result<(), Error>` - Success or a binrw error. ### Source [Source](https://docs.rs/binrw/0.15.2/x86_64-unknown-linux-gnu/src/binrw/binwrite/mod.rs.html#82-84) ``` -------------------------------- ### Load Savegame from Bytes and File Source: https://docs.rs/aoe2rec/latest/src/aoe2rec/lib.rs.html Provides two constructors for `Savegame`: `from_bytes` reads from a `bytes::Bytes` buffer, and `from_file` reads from a file path. Both use a `BufReader` and `read_le` to deserialize the savegame structure. ```rust impl Savegame { pub fn from_bytes(data: bytes::Bytes) -> Result> { let mut breader = BufReader::new(Cursor::new(data)); let savegame: Savegame = breader.read_le()?; Ok(savegame) } pub fn from_file(path: &std::path::Path) -> Result> { let file = File::open(path)?; let mut reader = BufReader::new(file); let savegame: Savegame = reader.read_le()?; Ok(savegame) } } ``` -------------------------------- ### write_options Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Writes the MinimalGameSettings to a writer using the given endianness and arguments. This method is part of the BinWrite trait implementation. ```APIDOC ## write_options ### Description Writes the MinimalGameSettings to a writer using the given endianness and arguments. This method is part of the BinWrite trait implementation. ### Method write_options ### Signature fn write_options(&self, writer: &mut W, endian: Endian, arguments: Self::Args<'\_>) -> BinResult<()> ### Parameters - **writer** (&mut W) - Required - The writer to write to. - **endian** (Endian) - Required - The endianness to use. - **arguments** (Self::Args<'\_>) - Required - The arguments to use for writing. ### Return Value - **BinResult<()>** - Success or an error. ``` -------------------------------- ### impl Serialize for Bool32 Source: https://docs.rs/aoe2rec/latest/aoe2rec/struct.Bool32.html Serializes Bool32 using Serde. ```APIDOC ## impl Serialize for Bool32 ### Description Provides the Serialize trait implementation for Bool32, enabling serialization with Serde. ### Methods #### fn serialize(&self, serializer: S) -> Result where S: Serializer, Serialize this value into the given Serde serializer. ``` -------------------------------- ### write_ne_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Writes the PlayerInit struct to a writer using native-endian byte order with the given arguments. ```APIDOC ## write_ne_args ### Description Writes `Self` to the writer, assuming native-endian byte order, using the given arguments. ### Method write_ne_args ### Signature ```rust fn write_ne_args(&self, writer: &mut W, args: Self::Args<'_>) -> Result<(), Error> where W: Write + Seek ``` ### Parameters - **writer** (`&mut W`) - Required - The writer to write the data to. - **args** (`Self::Args<'_>`) - Required - The arguments for writing. ### Return Value - `Result<(), Error>` - Success or an error during writing. ### Constraints - `W` must implement `Write` and `Seek` traits. ``` -------------------------------- ### read_le_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Reads the PlayerInit struct from a reader using little-endian byte order and provided arguments. ```APIDOC ## read_le_args ### Description Reads the PlayerInit struct from a reader, assuming little-endian byte order, using the given arguments. ### Method read_le_args ### Signature fn read_le_args(reader: &mut R, args: Self::Args<'_>) -> Result where R: Read + Seek ### Parameters - **reader** (&mut R) - Required - The reader to read from. Must implement Read and Seek. - **args** (Self::Args<'_>) - Required - The arguments to use for reading. ### Returns - **Result** - The parsed PlayerInit struct or an error. ``` -------------------------------- ### impl Serialize for Initial Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.Initial.html The Serialize trait implementation for the Initial struct, allowing it to be serialized using Serde. ```APIDOC ## impl Serialize for Initial ### Description Implements the `Serialize` trait for the `Initial` struct, enabling serialization of the struct using Serde serializers. ### Method `serialize` ### Signature ```rust fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer, ``` ### Parameters - `&self` - Reference to the `Initial` instance. - `__serializer` (Serializer) - The Serde serializer to use. ### Returns - `Result<__S::Ok, __S::Error>` - The serialized output or an error. ### Description Serializes this value into the given Serde serializer. ``` -------------------------------- ### Implement Serialize for MyNullString Source: https://docs.rs/aoe2rec/latest/src/aoe2rec/lib.rs.html Implements `serde::Serialize` for `MyNullString`, serializing the internal text as a string using `from_utf8_lossy`. Required for JSON or other serialization formats. ```rust impl serde::Serialize for MyNullString { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { let strvalue = std::string::String::from_utf8_lossy(&self.text); serializer.serialize_str(&strvalue) } } ``` -------------------------------- ### read_be_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Reads the PlayerInit struct from a reader using big-endian byte order and provided arguments. ```APIDOC ## read_be_args ### Description Reads the PlayerInit struct from a reader, assuming big-endian byte order, using the given arguments. ### Method read_be_args ### Signature fn read_be_args(reader: &mut R, args: Self::Args<'_>) -> Result where R: Read + Seek ### Parameters - **reader** (&mut R) - Required - The reader to read from. Must implement Read and Seek. - **args** (Self::Args<'_>) - Required - The arguments to use for reading. ### Returns - **Result** - The parsed PlayerInit struct or an error. ``` -------------------------------- ### impl BinRead for PlayerInit Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Implements the BinRead trait for the PlayerInit struct, enabling binary deserialization of player initialization data. The associated Args type is a tuple of (u8, u16, u16). ```APIDOC ## impl BinRead for PlayerInit ### Description Implements the `BinRead` trait for the `PlayerInit` struct, allowing it to be read from binary data using the `binrw` crate. ### Associated Type - **Args**<'__binrw_generated_args_lifetime> = ([u8](https://doc.rust-lang.org/nightly/std/primitive.u8.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html)) - The type used for the `args` parameter of `read_args()` and `read_options()`. ### Methods #### fn read_options(__binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>) -> BinResult Read `Self` from the reader using the given `Endian` and arguments. #### fn read_be(reader: &mut R) -> Result where R: Read + Seek, Self::Args<'a>: for<'a> Required Read `Self` from the reader using default arguments and assuming big-endian byte order. #### fn read_le(reader: &mut R) -> Result where R: Read + Seek, Self::Args<'a>: for<'a> Required Read `Self` from the reader using default arguments and assuming little-endian byte order. ``` -------------------------------- ### write_be_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Writes the MinimalGameSettings struct to a writer using big-endian byte order and the given arguments. This method is part of the binrw BinWrite trait implementation. ```APIDOC ## write_be_args ### Description Writes `Self` to the writer, assuming big-endian byte order, using the given arguments. ### Method `fn write_be_args(&self, writer: &mut W, args: Self::Args<'a>) -> Result<(), Error>` ### Parameters - `writer` (`&mut W`) - Required - The writer to write to. Must implement `Write + Seek`. - `args` (`Self::Args<'a>`) - Required - The arguments to use for writing. ### Return Value `Result<(), Error>` - Returns `Ok(())` on success, or an `Error` on failure. ### Constraints - `W: Write + Seek` ``` -------------------------------- ### impl BinRead for MinimalGameSettings Source: https://docs.rs/aoe2rec/latest/aoe2rec/minimal/struct.MinimalGameSettings.html Implements the BinRead trait for MinimalGameSettings, enabling binary deserialization with configurable endianness and arguments. ```APIDOC ## impl BinRead for MinimalGameSettings ### Description Implements the `BinRead` trait for `MinimalGameSettings`, allowing binary deserialization from a reader with configurable endianness and arguments. ### Associated Type - **Args**<'__binrw_generated_args_lifetime> = ([u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html),) - The type used for the `args` parameter of `read_args()` and `read_options()`. ### Methods #### fn read_options(__binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'__binrw_generated_args_lifetime>) -> BinResult Read `Self` from the reader using the given `Endian` and arguments. #### fn read(reader: &mut R) -> Result where R: Read + Seek, Self: ReadEndian, Self::Args<'a>: for<'a> Required Read `Self` from the reader using default arguments. #### fn read_be(reader: &mut R) -> Result where R: Read + Seek, Self: Args<'a>: for<'a> Required Read `Self` from the reader using big-endian byte order. ``` -------------------------------- ### ActionData::Follow Source: https://docs.rs/aoe2rec/latest/aoe2rec/actions/enum.ActionData.html Represents a follow action. Contains the player ID, action length, and raw data. ```APIDOC ## ActionData::Follow ### Description Represents a follow action in the game. ### Fields - **player_id** (u8) - The ID of the player who issued the follow command. - **action_length** (u16) - The length of the action data. - **data** (Vec) - The raw action data. ``` -------------------------------- ### read_le Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Reads the PlayerInit struct from a reader using default arguments and little-endian byte order. ```APIDOC ## read_le ### Description Reads the PlayerInit struct from a reader using default arguments and assuming little-endian byte order. ### Method read_le ### Signature fn read_le(reader: &mut R) -> Result where R: Read + Seek, Self::Args<'a>: for<'a> Required ### Parameters - **reader** (&mut R) - Required - The reader to read from. Must implement Read and Seek. ### Returns - **Result** - The parsed PlayerInit struct or an error. ``` -------------------------------- ### BinRead for Initial Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.Initial.html The Initial struct implements the BinRead trait, providing methods to read the struct from a binary reader with configurable endianness and arguments. ```APIDOC ## BinRead for Initial ### Description Implements the `BinRead` trait for the `Initial` struct, allowing it to be read from binary data using the `binrw` crate. ### Associated Type - **Args**<'__binrw_generated_args_lifetime> = ([u8](https://doc.rust-lang.org/nightly/std/primitive.u8.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html)) - The type used for the `args` parameter of `read_args()` and `read_options()`. ### Methods #### read_options - **Signature**: `fn read_options(__binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>) -> BinResult` - **Description**: Reads `Self` from the reader using the given `Endian` and arguments. #### read_be - **Signature**: `fn read_be(reader: &mut R) -> Result where R: Read + Seek, Self::Args<'a>: for<'a> Required` - **Description**: Reads `Self` from the reader using default arguments and assuming big-endian byte order. #### read_le - **Signature**: `fn read_le(reader: &mut R) -> Result where R: Read + Seek, Self::Args<'a>: for<'a> Required` - **Description**: Reads `Self` from the reader using default arguments and assuming little-endian byte order. ``` -------------------------------- ### read_be_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/struct.SyncOperation.html Reads a SyncOperation from the reader assuming big-endian byte order, using the given arguments. ```APIDOC ## read_be_args ### Description Reads `Self` from the reader, assuming big-endian byte order, using the given arguments. ### Method read_be_args ### Signature ```rust fn read_be_args(reader: &mut R, args: Self::Args<'_>) -> Result where R: Read + Seek, ``` ### Parameters - **reader** (`&mut R`) - Required - The reader to read from. Must implement `Read` and `Seek`. - **args** (`Self::Args<'_>`) - Required - The arguments for reading. ### Returns - `Result` - The parsed `SyncOperation` or an error. ``` -------------------------------- ### Struct Initial Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.Initial.html The Initial struct represents the initial header data of an Age of Empires II recorded game. It contains fields for restore time, particle count and data, an identifier, player initialization data, and an unknown byte array. ```APIDOC ## Struct Initial ### Description The Initial struct represents the initial header data of an Age of Empires II recorded game. It contains fields for restore time, particle count and data, an identifier, player initialization data, and an unknown byte array. ### Fields - **restore_time** (u32) - The restore time value. - **num_particles** (u32) - The number of particles. - **particles** (Vec) - The particle data. - **identifier** (u32) - The identifier value. - **players** (Vec) - The player initialization data. - **unknown1** ([u8; 21]) - An unknown byte array of length 21. ### Example ```rust pub struct Initial { pub restore_time: u32, pub num_particles: u32, pub particles: Vec, pub identifier: u32, pub players: Vec, pub unknown1: [u8; 21], } ``` ``` -------------------------------- ### write_le Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.PlayerInit.html Writes the PlayerInit struct to a writer using little-endian byte order. This method is part of the BinWrite trait implementation. ```APIDOC ## write_le ### Description Writes `Self` to the writer assuming little-endian byte order. ### Method write_le ### Signature ```rust fn write_le(&self, writer: &mut W) -> Result<(), Error> where W: Write + Seek, Self::Args<'a>: for<'a> Required, ``` ### Parameters - **writer** (`&mut W`) - Required - The writer to write the struct to. Must implement `Write` and `Seek`. ### Return Value - `Result<(), Error>` - Returns `Ok(())` on success, or an `Error` on failure. ### Notes - This method is part of the `BinWrite` trait implementation for `PlayerInit`. - The byte order is little-endian. ``` -------------------------------- ### read_le_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.GameSettings.html Reads the GameSettings struct from a reader using little-endian byte order with provided arguments. ```APIDOC ## read_le_args ### Description Reads the GameSettings struct from a reader using little-endian byte order with provided arguments. ### Method read_le_args ### Signature ```rust fn read_le_args(reader: &mut R, args: Self::Args<'_>) -> Result where R: Read + Seek ``` ### Parameters - **reader** (`&mut R`) - Required - The reader to read from. - **args** (`Self::Args<'_>`) - Required - Arguments for reading. ### Return Value Returns a `Result` containing the parsed GameSettings or an error. ``` -------------------------------- ### write_le_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.GameSettings.html Writes the GameSettings struct to a writer using little-endian byte order, with additional arguments. This method is part of the BinWrite trait implementation. ```APIDOC ## write_le_args ### Description Writes `Self` to the writer, assuming little-endian byte order, using the given arguments. ### Method write_le_args ### Signature ```rust fn write_le_args( &self, writer: &mut W, args: Self::Args<'_,>, ) -> Result<(), Error> where W: Write + Seek, ``` ### Parameters - **writer** (`&mut W`) - Required - The writer to write the data to. Must implement `Write` and `Seek`. - **args** (`Self::Args<'_,>`) - Required - The arguments to use for writing. ### Return Value - `Result<(), Error>` - Returns `Ok(())` on success, or an `Error` on failure. ### Notes - This method is part of the `BinWrite` trait implementation for `GameSettings`. ``` -------------------------------- ### read_be_args Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.GameSettings.html Reads the GameSettings struct from a reader using big-endian byte order with custom arguments. ```APIDOC ## read_be_args ### Description Reads the GameSettings struct from a reader using big-endian byte order with custom arguments. ### Method read_be_args ### Signature fn read_be_args(reader: &mut R, args: Self::Args<'_>) -> Result where R: Read + Seek ### Parameters - **reader** (&mut R) - Required - The reader to read from. Must implement Read and Seek. - **args** (Self::Args<'_>) - Required - The arguments to use for reading. ### Return Value - **Result** - The parsed GameSettings struct or an error. ``` -------------------------------- ### write_le Source: https://docs.rs/aoe2rec/latest/aoe2rec/header/struct.GameSettings.html Writes the GameSettings struct to a writer assuming little-endian byte order. This is a convenience method for little-endian serialization. ```APIDOC ## write_le ### Description Writes `Self` to the writer assuming little-endian byte order. ### Method write_le ### Signature ```rust fn write_le(&self, writer: &mut W) -> Result<(), Error> where W: Write + Seek, Self::Args<'a>: for<'a> Required, ``` ### Parameters - **writer** (`&mut W`) - Required - The writer to write to. ### Returns - `Result<(), Error>` - Result indicating success or failure. ```