pub struct Buffer { /* private fields */ }Expand description
Manager for the retrospective buffer.
Implementations§
Source§impl Buffer
impl Buffer
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if buffering is enabled.
Sourcepub fn should_exclude(&self, cmd: &str) -> bool
pub fn should_exclude(&self, cmd: &str) -> bool
Check if a command should be excluded from buffering.
Combines hooks.ignore_patterns and buffer.exclude_patterns.
Sourcepub fn start_entry(
&self,
cmd: &str,
cwd: &str,
session_id: &str,
) -> Result<Uuid>
pub fn start_entry( &self, cmd: &str, cwd: &str, session_id: &str, ) -> Result<Uuid>
Start a new buffer entry. Returns the entry ID for writing output.
Sourcepub fn complete_entry(
&self,
id: &Uuid,
exit_code: i32,
duration_ms: i64,
) -> Result<()>
pub fn complete_entry( &self, id: &Uuid, exit_code: i32, duration_ms: i64, ) -> Result<()>
Complete a buffer entry with exit code and duration.
Sourcepub fn write_complete_entry(
&self,
cmd: &str,
cwd: &str,
session_id: &str,
exit_code: i32,
duration_ms: Option<i64>,
output: Option<&[u8]>,
) -> Result<Uuid>
pub fn write_complete_entry( &self, cmd: &str, cwd: &str, session_id: &str, exit_code: i32, duration_ms: Option<i64>, output: Option<&[u8]>, ) -> Result<Uuid>
Write a complete buffer entry at once (for shq save --to-buffer).
This is used when all data is available at once (command already completed).
Sourcepub fn list_entries(&self) -> Result<Vec<BufferEntry>>
pub fn list_entries(&self) -> Result<Vec<BufferEntry>>
List all buffer entries, sorted by start time (most recent first).
Sourcepub fn get_by_position(&self, position: usize) -> Result<Option<BufferEntry>>
pub fn get_by_position(&self, position: usize) -> Result<Option<BufferEntry>>
Get a buffer entry by position (1 = most recent).
Sourcepub fn read_output(&self, entry: &BufferEntry) -> Result<Vec<u8>>
pub fn read_output(&self, entry: &BufferEntry) -> Result<Vec<u8>>
Read output from a buffer entry.
Sourcepub fn delete_entry(&self, id: &Uuid) -> Result<()>
pub fn delete_entry(&self, id: &Uuid) -> Result<()>
Delete a buffer entry.
Auto Trait Implementations§
impl Freeze for Buffer
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnwindSafe for Buffer
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
Mutably borrows from an owned value. Read more