Struct vault::Replay

source ·
pub struct Replay { /* private fields */ }
Expand description

A complete representation of all information able to be parsed from a Company of Heroes 3 replay. Note that parsing is not yet exhaustive, and iterative improvements will be made to pull more information from replay files over time.

Implementations§

source§

impl Replay

source

pub fn from_bytes(input: &[u8]) -> Result<Replay, ParseError<'_>>

Takes a byte slice, parses it as a CoH3 replay, and returns a representation of the parsed information. Any failures during parsing or conversion will return an error.

fn main() {
    let data = include_bytes!("/path/to/replay.rec");
    let replay = vault::Replay::from_bytes(data);
    assert!(replay.is_ok())
}
source

pub fn version(&self) -> u16

The Company of Heroes 3 game version this replay was recorded on. Note that this is probably more accurated described as the build version, and represents the final segment of digits you see in the game version on the game’s main menu. Every time the game is patched, this version will change, and replays are generally only viewable on the same game version they were recorded on.

source

pub fn timestamp(&self) -> &str

A UTF-16 representation of the recording user’s local time when the replay was recorded. Note that value may contain non-standard characters and is not guaranteed to be parsable into an accurate date/time format.

source

pub fn game_type(&self) -> GameType

The type of game this replay represents. Note that this information is parsed on a best- effort basis and therefore may not always be correct. Also note that it’s currently not known if there’s a way to differentiate between automatch and custom games for replays recorded before the replay system release in patch 1.4.0. Games played before that patch will be marked as either Skirmish (for local AI games) or Multiplayer (for networked custom or automatch games). Games recorded on or after patch 1.4.0 will properly differentiate between Custom and Automatch games.

source

pub fn matchhistory_id(&self) -> Option<u64>

The ID used by Relic to track this match on their internal servers. This ID can be matched with an ID of the same name returned by Relic’s CoH3 stats API, enabling linkage between replay files and statistical information for a match. When the game type is Skirmish, there is no ID assigned by Relic, so this will be None.

source

pub fn mod_uuid(&self) -> Uuid

The UUID of the base game mod this replay ran on. If no mod was used, this will be a nil UUID (all zeroes).

source

pub fn map(&self) -> Map

Map information for this match.

source

pub fn map_filename(&self) -> &str

Filename of the map this match was played on. See Map::filename for more information.

source

pub fn map_localized_name_id(&self) -> &str

Localization ID of the map’s name. See Map::localized_name_id for more information.

source

pub fn map_localized_description_id(&self) -> &str

Localization ID of the map’s description. See Map::localized_description_id for more information.

source

pub fn players(&self) -> Vec<Player>

A list of all players who participated in this match.

source

pub fn length(&self) -> usize

A simple count of the number of ticks that were executed in this match. Because CoH3’s engine runs at 8 ticks per second, you can divide this value by 8 to get the duration of the match in seconds.

Trait Implementations§

source§

impl Debug for Replay

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Replay

§

impl RefUnwindSafe for Replay

§

impl Send for Replay

§

impl Sync for Replay

§

impl Unpin for Replay

§

impl UnwindSafe for Replay

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.