Struct AsciiCast

Source
pub struct AsciiCast<'a> { /* private fields */ }
Expand description

An asciicast v2 file.

§Creation

Can be created using the AsciiCast::new method, which accepts a writer and returns an empty asciicast without any events. To modify header and write events to an asciicast, you can call respective methods (see “Header” and “Events” section).

§Modification

You can modify the header of the asciicast using the following methods:

  • width: Set the initial terminal width.
  • height: Set the initial terminal height.
  • timestamp: Set the unix timestamp of the beginning of the recording session.
  • idle_time_limit: Set the idle time limit.
  • title: Set the title of the asciicast.

After you’ve finished, write the header to the asciicast using the write_header method explicitly. If you don’t, the header will be written implicitly when you write the first event. Note that the header can only be written once, either explicitly or implicitly.

§Events

You can add events to the asciicast using the following methods:

  • output: Add an output event to the asciicast.
  • input: Add an input event to the asciicast.
  • marker: Add a marker event to the asciicast.
  • resize: Add a resize event to the asciicast.

§Output

The asciicast will be streamed to the writer you provided, every time you add an event or write the header.

Implementations§

Source§

impl<'a> AsciiCast<'a>

Source

pub fn new(writer: &'a mut dyn Write) -> Self

Create a new asciicast.

Source

pub fn width(&mut self, width: u16) -> Result<&mut Self, ErrorType>

Set the initial terminal width.

Source

pub fn height(&mut self, height: u16) -> Result<&mut Self, ErrorType>

Set the initial terminal height.

Source

pub fn timestamp(&mut self, timestamp: u64) -> Result<&mut Self, ErrorType>

Set the unix timestamp of the beginning of the recording session.

Source

pub fn idle_time_limit( &mut self, idle_time_limit: f64, ) -> Result<&mut Self, ErrorType>

Set the idle time limit.

Source

pub fn title(&mut self, title: String) -> Result<&mut Self, ErrorType>

Set the title of the asciicast.

Source

pub fn write_header(&mut self) -> Result<&mut Self, ErrorType>

Write the header to the writer.

Source

pub fn output(&mut self, time: u64, data: &str) -> Result<&mut Self, ErrorType>

Write an output event to the asciicast.

Source

pub fn input(&mut self, time: u64, data: &str) -> Result<&mut Self, ErrorType>

Write an input event to the asciicast.

Source

pub fn marker(&mut self, time: u64, name: &str) -> Result<&mut Self, ErrorType>

Write a marker event to the asciicast.

Source

pub fn resize( &mut self, time: u64, columns: u16, rows: u16, ) -> Result<&mut Self, ErrorType>

Write a resize event to the asciicast.

Auto Trait Implementations§

§

impl<'a> Freeze for AsciiCast<'a>

§

impl<'a> !RefUnwindSafe for AsciiCast<'a>

§

impl<'a> !Send for AsciiCast<'a>

§

impl<'a> !Sync for AsciiCast<'a>

§

impl<'a> Unpin for AsciiCast<'a>

§

impl<'a> !UnwindSafe for AsciiCast<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.