pub struct PaneRecording { /* private fields */ }Expand description
State of a per-pane recording. Cheap when disabled — the
on_bytes hook hits a single boolean check before deciding
whether to deep-copy the chunk.
Implementations§
Source§impl PaneRecording
impl PaneRecording
pub fn new(max_events: usize) -> Self
Sourcepub fn enable(&self, cols: u16, rows: u16)
pub fn enable(&self, cols: u16, rows: u16)
Begin (or restart) recording. Clears prior events; stamps the start instant; remembers the pane dimensions for the cast header.
Sourcepub fn disable(&self)
pub fn disable(&self)
Stop recording. Retains captured events so an operator can
export them after stopping; a subsequent enable()
clears + restarts.
Sourcepub fn epoch_anchor(&self) -> Option<u64>
pub fn epoch_anchor(&self) -> Option<u64>
Wall-clock start of the current recording, unix epoch ms.
The join key for anything stamped in epoch time. Self::read_around
takes ms since enable(), so a caller holding an epoch timestamp
must convert through this anchor:
rel_ms = epoch_ms.saturating_sub(anchor)Passing an epoch timestamp straight to read_around is off by
~1.7e12 ms and silently returns the buffer tail — it does not error,
which is why this accessor exists rather than leaving callers to
guess.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether recording is currently capturing new events.
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Number of currently-buffered events.
Sourcepub fn push(&self, bytes: &[u8])
pub fn push(&self, bytes: &[u8])
Append a PTY chunk. Cheap no-op when recording is disabled. Ring-evicts the oldest event if the cap is hit.
Sourcepub fn to_cast_json(&self) -> String
pub fn to_cast_json(&self) -> String
Export as asciinema v2 .cast (JSON-lines). The first line
is the header object; every subsequent line is
[t_seconds, "o", "<utf-8 chunk>"]. Returns the full
string ready to write to disk or pipe to asciinema play.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PaneRecording
impl RefUnwindSafe for PaneRecording
impl Send for PaneRecording
impl Sync for PaneRecording
impl Unpin for PaneRecording
impl UnsafeUnpin for PaneRecording
impl UnwindSafe for PaneRecording
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.