pub struct Replay {
pub header: ReplayHeader,
pub inputs: Vec<TimedInput>,
pub checkpoints: Vec<StateCheckpoint>,
pub metadata: HashMap<String, String>,
}Expand description
A complete replay recording
Fields§
§header: ReplayHeaderReplay header
inputs: Vec<TimedInput>All timed inputs
checkpoints: Vec<StateCheckpoint>State checkpoints (for verification)
metadata: HashMap<String, String>Metadata
Implementations§
Source§impl Replay
impl Replay
Sourcepub fn new(header: ReplayHeader) -> Self
pub fn new(header: ReplayHeader) -> Self
Create a new replay
Sourcepub fn add_input(&mut self, frame: u64, event: InputEvent)
pub fn add_input(&mut self, frame: u64, event: InputEvent)
Add an input event
Sourcepub fn add_checkpoint(&mut self, checkpoint: StateCheckpoint)
pub fn add_checkpoint(&mut self, checkpoint: StateCheckpoint)
Add a state checkpoint
Sourcepub fn set_metadata(&mut self, key: &str, value: &str)
pub fn set_metadata(&mut self, key: &str, value: &str)
Add metadata
Sourcepub fn inputs_at_frame(&self, frame: u64) -> Vec<&InputEvent>
pub fn inputs_at_frame(&self, frame: u64) -> Vec<&InputEvent>
Get inputs for a specific frame
Sourcepub fn checkpoint_at_or_before(&self, frame: u64) -> Option<&StateCheckpoint>
pub fn checkpoint_at_or_before(&self, frame: u64) -> Option<&StateCheckpoint>
Get checkpoint at or before a frame
Sourcepub fn compute_checksum(&self) -> String
pub fn compute_checksum(&self) -> String
Compute checksum of replay data
Sourcepub fn verify_checksum(&self) -> bool
pub fn verify_checksum(&self) -> bool
Verify replay checksum
Sourcepub fn save_yaml(&self, path: &Path) -> ProbarResult<()>
pub fn save_yaml(&self, path: &Path) -> ProbarResult<()>
Save replay to YAML file
Sourcepub fn load_yaml(path: &Path) -> ProbarResult<Self>
pub fn load_yaml(path: &Path) -> ProbarResult<Self>
Load replay from YAML file
Sourcepub fn save_json(&self, path: &Path) -> ProbarResult<()>
pub fn save_json(&self, path: &Path) -> ProbarResult<()>
Save replay to JSON file
Sourcepub fn load_json(path: &Path) -> ProbarResult<Self>
pub fn load_json(path: &Path) -> ProbarResult<Self>
Load replay from JSON file
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Replay
impl<'de> Deserialize<'de> for Replay
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. 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 UnsafeUnpin for Replay
impl UnwindSafe for Replay
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more