[−][src]Struct ttyrec::Parser
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
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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,