pub struct CircularBuffer { /* private fields */ }Expand description
Circular buffer for storing PTY output lines with configurable size limit Provides efficient memory-bounded storage with O(1) append operations
Implementations§
Source§impl CircularBuffer
impl CircularBuffer
Sourcepub fn new(max_size: usize) -> Self
pub fn new(max_size: usize) -> Self
Create a new circular buffer with the specified maximum size
Sourcepub fn push(&mut self, line: String)
pub fn push(&mut self, line: String)
Add a line to the buffer, removing the oldest if at capacity
Sourcepub fn get_all_lines(&self) -> Vec<String>
pub fn get_all_lines(&self) -> Vec<String>
Get all lines as a vector (for display purposes)
Sourcepub fn get_last_lines(&self, n: usize) -> Vec<String>
pub fn get_last_lines(&self, n: usize) -> Vec<String>
Get the last N lines (most recent)
Sourcepub fn get_lines_range(&self, start: usize, count: usize) -> Vec<String>
pub fn get_lines_range(&self, start: usize, count: usize) -> Vec<String>
Get lines within a range (for scrolling)
Sourcepub fn get_content(&self) -> String
pub fn get_content(&self) -> String
Get all lines as a single string (joined with newlines)
Sourcepub fn get_recent_content(&self, lines: usize) -> String
pub fn get_recent_content(&self, lines: usize) -> String
Get the last N lines as a single string
Sourcepub fn set_max_size(&mut self, new_max_size: usize)
pub fn set_max_size(&mut self, new_max_size: usize)
Set new maximum size (may truncate existing content)
Sourcepub fn get_stats(&self) -> BufferStats
pub fn get_stats(&self) -> BufferStats
Get diagnostic information about the buffer
Sourcepub fn search(&self, query: &str) -> Vec<(usize, String)>
pub fn search(&self, query: &str) -> Vec<(usize, String)>
Search for lines containing the given text (case-insensitive)
Sourcepub fn get_lines_reverse(&self) -> Vec<String>
pub fn get_lines_reverse(&self) -> Vec<String>
Get lines in reverse order (most recent first)
Trait Implementations§
Source§impl Clone for CircularBuffer
impl Clone for CircularBuffer
Source§fn clone(&self) -> CircularBuffer
fn clone(&self) -> CircularBuffer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CircularBuffer
impl Debug for CircularBuffer
Auto Trait Implementations§
impl Freeze for CircularBuffer
impl RefUnwindSafe for CircularBuffer
impl Send for CircularBuffer
impl Sync for CircularBuffer
impl Unpin for CircularBuffer
impl UnsafeUnpin for CircularBuffer
impl UnwindSafe for CircularBuffer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.