[−][src]Struct elma::rec::Replay
Replay struct
Fields
flag_tag: bool
Whether replay is flag-tag or not.
link: u32
Random number to link with level file.
level: String
Full level filename.
path: Option<PathBuf>
Path to file.
rides: Vec<Ride>
Rides of players.
Methods
impl Replay
[src]
impl Replay
[src]
pub fn new() -> Self
[src]
pub fn load<P: Into<PathBuf>>(path: P) -> Result<Self, ElmaError>
[src]
Loads a replay file and returns a Replay struct.
Examples
let rec = Replay::load("tests/assets/replays/test_1.rec").unwrap();
pub fn from_bytes<B: AsRef<[u8]>>(buffer: B) -> Result<Self, ElmaError>
[src]
pub fn to_bytes(&self) -> Result<Vec<u8>, ElmaError>
[src]
Returns replay data as a buffer of bytes.
pub fn save<P: Into<PathBuf>>(&mut self, path: P) -> Result<(), ElmaError>
[src]
Save replay as a file.
pub fn get_time_ms(&self) -> (usize, bool)
[src]
Get time of replay. Returns tuple with milliseconds and whether replay was finished, caveat being that there is no way to tell if a replay was finished or not just from the replay file with a 100% certainty. Merely provided for convenience.
Examples
let replay = Replay::load("tests/assets/replays/test_1.rec").unwrap(); let (time, finished) = replay.get_time_ms(); assert_eq!(time, 14649); assert_eq!(finished, true);
pub fn get_time_hs(&self) -> (usize, bool)
[src]
Get time of replay. Returns tuple with hundredths and whether replay was finished, caveat being that there is no way to tell if a replay was finished or not just from the replay file with a 100% certainty. Merely provided for convinience.
Examples
let replay = Replay::load("tests/assets/replays/test_1.rec").unwrap(); let (time, finished) = replay.get_time_hs(); assert_eq!(time, 1464); assert_eq!(finished, true);
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,