[−][src]Struct ttyrec::Writer
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,
W: Send,
impl<W> Sync for Writer<W> where
W: Sync,
W: Sync,
impl<W> Unpin for Writer<W> where
W: Unpin,
W: Unpin,
impl<W> UnwindSafe for Writer<W> where
W: UnwindSafe,
W: UnwindSafe,
impl<W> RefUnwindSafe for Writer<W> where
W: RefUnwindSafe,
W: RefUnwindSafe,
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, 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,