pub struct Parser { /* private fields */ }
Expand description
Parses ttyrec streams.
Designed to be able to be used in a streaming/asynchronous fashion. As you
read bytes from the ttyrec stream (whether from a file or whatever else),
call the add_bytes
method to add them to the
internal buffer. At any point, you can call
next_frame
to then return the next complete frame
if one has been read.
Implementations§
source§impl Parser
impl Parser
sourcepub fn next_frame(&mut self) -> Option<Frame>
pub fn next_frame(&mut self) -> Option<Frame>
Try to read a frame from the internal buffer.
If a complete frame is found, the bytes for that frame will be removed
from the internal buffer and the frame object will be returned. If a
complete frame is not found, this method will return None
.
sourcepub fn offset(&self) -> Option<Duration>
pub fn offset(&self) -> Option<Duration>
How much the timestamps in this file should be offset by.
Ttyrec files are allowed to be generated by just inserting the current absolute timestamp as the header. This means that during playback, we need to take the timestamp of the first frame as the start time, and each frame timestamp after that should be offset by that same amount.
Returns None
if no frames have been read yet.