diff --git a/README.md b/README.md index cf08a3d..918eba2 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,22 @@ Roblox Bhop/Surf Bot File Format ## Example ```rust -use strafesnet_roblox_bot_file::File; +use strafesnet_roblox_bot_file::{File,TimedBlockId}; let file=std::fs::File::open("bot_file")?; let input=std::io::BufReader::new(file); -let bot_file=File::new(input)?; - -for &(time,block_id) in &bot_file.header.offline_blocks_timeline{ - let block=bot_file.read_block(block_id)?; +let mut bot_file=File::new(input)?; +for &TimedBlockId{time,block_id} in &bot_file.header.offline_blocks_timeline{ + // header is immutably borrowed + // while data is mutably borrowed + let block_info=bot_file.header.block_info(block_id)?; + let block=bot_file.data.read_block_info(block_info)?; // offline blocks include the following event types: // World, Gravity, Run, Camera, Setting } -for &(time,block_id) in &bot_file.header.realtime_blocks_timeline{ - let block=bot_file.read_block(block_id)?; +for &TimedBlockId{time,block_id} in &bot_file.header.realtime_blocks_timeline{ + let block_info=bot_file.header.block_info(block_id)?; + let block=bot_file.data.read_block_info(block_info)?; // realtime blocks include the following event types: // Input, Output, Sound }