mirror of
https://github.com/speice-io/marketdata-shootout
synced 2025-07-04 23:34:52 -04:00
Able to replay an entire DEEP file!
This commit is contained in:
16
src/main.rs
16
src/main.rs
@ -3,9 +3,8 @@ use std::io::Read;
|
||||
use std::path::Path;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use nom::sequence::tuple;
|
||||
|
||||
use parsers::Block;
|
||||
use crate::iex::IexParser;
|
||||
|
||||
// Cap'n'Proto and Flatbuffers typically ask that you generate code on the fly to match
|
||||
// the schemas. For purposes of auto-complete and easy browsing in the repository,
|
||||
@ -35,16 +34,7 @@ fn main() {
|
||||
let mut buf = Vec::new();
|
||||
file.read_to_end(&mut buf).expect(&format!("Unable to read file={}", path.display()));
|
||||
|
||||
let mut rem = &buf[..];
|
||||
while let Ok((unparsed, block)) = parsers::read_block(rem) {
|
||||
let offset = (unparsed.as_ptr() as usize) - (buf.as_ptr() as usize);
|
||||
rem = unparsed;
|
||||
match block {
|
||||
Block::SectionHeader(sh) => println!("{:?}, next offset={}", sh, offset),
|
||||
Block::InterfaceDescription(id) => println!("{:?}, next offset={}", id, offset),
|
||||
Block::EnhancedPacket(epb) => println!("EnhancedPacketBlock {{ block_len: {}, packet_len: {} }}, next offset={}", epb.block_len, epb.packet_data.len(), offset)
|
||||
}
|
||||
for _payload in IexParser::new(&buf[..]) {
|
||||
//dbg!(payload);
|
||||
}
|
||||
|
||||
println!("Remaining unparsed len={}", rem.len());
|
||||
}
|
||||
|
Reference in New Issue
Block a user