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
§Header
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>
impl<'a> AsciiCast<'a>
Sourcepub fn width(&mut self, width: u16) -> Result<&mut Self, ErrorType>
pub fn width(&mut self, width: u16) -> Result<&mut Self, ErrorType>
Set the initial terminal width.
Sourcepub fn height(&mut self, height: u16) -> Result<&mut Self, ErrorType>
pub fn height(&mut self, height: u16) -> Result<&mut Self, ErrorType>
Set the initial terminal height.
Sourcepub fn timestamp(&mut self, timestamp: u64) -> Result<&mut Self, ErrorType>
pub fn timestamp(&mut self, timestamp: u64) -> Result<&mut Self, ErrorType>
Set the unix timestamp of the beginning of the recording session.
Sourcepub fn idle_time_limit(
&mut self,
idle_time_limit: f64,
) -> Result<&mut Self, ErrorType>
pub fn idle_time_limit( &mut self, idle_time_limit: f64, ) -> Result<&mut Self, ErrorType>
Set the idle time limit.
Sourcepub fn title(&mut self, title: String) -> Result<&mut Self, ErrorType>
pub fn title(&mut self, title: String) -> Result<&mut Self, ErrorType>
Set the title of the asciicast.
Sourcepub fn write_header(&mut self) -> Result<&mut Self, ErrorType>
pub fn write_header(&mut self) -> Result<&mut Self, ErrorType>
Write the header to the writer.
Sourcepub fn output(&mut self, time: u64, data: &str) -> Result<&mut Self, ErrorType>
pub fn output(&mut self, time: u64, data: &str) -> Result<&mut Self, ErrorType>
Write an output event to the asciicast.
Sourcepub fn input(&mut self, time: u64, data: &str) -> Result<&mut Self, ErrorType>
pub fn input(&mut self, time: u64, data: &str) -> Result<&mut Self, ErrorType>
Write an input event to the asciicast.