[][src]Struct ttyrec::Writer

pub struct Writer<W> { /* fields omitted */ }

Writes ttyrec frames to a tokio::io::AsyncWrite instance.

Methods

impl<W: AsyncWrite> Writer<W>[src]

pub fn new(writer: W) -> Self[src]

Creates a new Writer from a tokio::io::AsyncWrite instance.

pub fn frame(&mut self, data: &[u8]) -> Result<(), Error>[src]

Generates a new ttyrec frame with the given data.

Equivalent to calling frame_at and passing std::time::Instant::now() as the time parameter.

pub fn frame_at(&mut self, time: Instant, data: &[u8]) -> Result<(), Error>[src]

Generates a new ttyrec frame with the given data at the given time.

The frame data will be stored on this object until written out by calls to poll_write.

Note that this is not guaranteed to do the correct thing unless the cur_time parameters given in each frame_at call are non-decreasing.

pub fn poll_write(&mut self) -> Poll<(), Error>[src]

Attempt to write serialized ttyrec frames to the underlying writer.

Writes data from the previous calls to frame and frame_at. Returns Ok(Async::Ready(())) if all bytes were written, and Ok(Async::NotReady) otherwise.

pub fn needs_write(&self) -> bool[src]

Returns true if there are still bytes that need to be written.

It is only necessary to call poll_write if this method returns true.

Auto Trait Implementations

impl<W> Send for Writer<W> where
    W: Send

impl<W> Sync for Writer<W> where
    W: Sync

impl<W> Unpin for Writer<W> where
    W: Unpin

impl<W> UnwindSafe for Writer<W> where
    W: UnwindSafe

impl<W> RefUnwindSafe for Writer<W> where
    W: RefUnwindSafe

Blanket Implementations

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

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

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]