[][src]Struct ttyrec::Parser

pub struct Parser { /* fields omitted */ }

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.

Methods

impl Parser[src]

pub fn new() -> Self[src]

Create a new Parser.

pub fn add_bytes(&mut self, bytes: &[u8])[src]

Add more bytes to the internal buffer.

pub fn next_frame(&mut self) -> Option<Frame>[src]

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.

pub fn offset(&self) -> Option<Duration>[src]

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.

Trait Implementations

impl Clone for Parser[src]

impl Default for Parser[src]

impl Debug for Parser[src]

Auto Trait Implementations

impl Send for Parser

impl Sync for Parser

impl Unpin for Parser

impl UnwindSafe for Parser

impl RefUnwindSafe for Parser

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]