pub struct ReplayData {
pub frame_data: FrameData,
pub meta: ReplayMeta,
pub demolish_infos: Vec<DemolishInfo>,
}Expand description
Complete replay data structure containing all extracted information from a Rocket League replay.
This is the top-level structure that contains all processed replay data including frame-by-frame information, replay metadata, and special events like demolitions.
§Fields
frame_data- All frame-by-frame data including ball, player, and metadata informationmeta- Replay metadata including player information, game settings, and statisticsdemolish_infos- Information about all demolition events that occurred during the replay
§Example
use subtr_actor::collector::replay_data::ReplayDataCollector;
use boxcars::ParserBuilder;
let data = std::fs::read("assets/replays/new_boost_format.replay").unwrap();
let replay = ParserBuilder::new(&data).parse().unwrap();
let collector = ReplayDataCollector::new();
let replay_data = collector.get_replay_data(&replay).unwrap();
// Access replay metadata
println!("Team 0 players: {}", replay_data.meta.team_zero.len());
// Access frame data
println!("Total frames: {}", replay_data.frame_data.metadata_frames.len());
// Access demolition events
println!("Total demolitions: {}", replay_data.demolish_infos.len());Fields§
§frame_data: FrameDataAll frame-by-frame data including ball, player, and metadata information
meta: ReplayMetaReplay metadata including player information, game settings, and statistics
demolish_infos: Vec<DemolishInfo>Information about all demolition events that occurred during the replay
Implementations§
Source§impl ReplayData
impl ReplayData
Sourcepub fn as_json(&self) -> Result<String, Error>
pub fn as_json(&self) -> Result<String, Error>
Serializes the replay data to a JSON string.
§Returns
Returns a Result containing either the JSON string representation
of the replay data or a serde_json::Error if serialization fails.
§Example
use subtr_actor::collector::replay_data::ReplayDataCollector;
use boxcars::ParserBuilder;
let data = std::fs::read("assets/replays/new_boost_format.replay").unwrap();
let replay = ParserBuilder::new(&data).parse().unwrap();
let collector = ReplayDataCollector::new();
let replay_data = collector.get_replay_data(&replay).unwrap();
let json_string = replay_data.as_json().unwrap();
println!("Replay as JSON: {}", json_string);Sourcepub fn as_pretty_json(&self) -> Result<String, Error>
pub fn as_pretty_json(&self) -> Result<String, Error>
Serializes the replay data to a pretty-printed JSON string.
§Returns
Returns a Result containing either the pretty-printed JSON string
representation of the replay data or a serde_json::Error if serialization fails.
Trait Implementations§
Source§impl Clone for ReplayData
impl Clone for ReplayData
Source§fn clone(&self) -> ReplayData
fn clone(&self) -> ReplayData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more