pub struct MessagesRing { /* private fields */ }Expand description
Bounded chronological ring of every echo the editor has
emitted. Push on every set_message; snapshot on demand
for :messages open and live refresh. Capacity is fixed
at construction; once full, the oldest entry drops to make
room for the newest.
Implementations§
Source§impl MessagesRing
impl MessagesRing
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Construct an empty ring with the given capacity. 0
is normalised via max(1) so push never silently
drops every record.
Sourcepub fn push(&mut self, record: MessageRecord)
pub fn push(&mut self, record: MessageRecord)
Append a record. Evicts the oldest entry when at capacity. O(1) amortized; the ring is bounded so a flood of messages stays at a fixed memory ceiling.
Sourcepub fn records(&self) -> &VecDeque<MessageRecord>
pub fn records(&self) -> &VecDeque<MessageRecord>
Borrow the records in chronological order (oldest first). Renderers walk this for the transcript view.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
Trait Implementations§
Source§impl Clone for MessagesRing
impl Clone for MessagesRing
Source§fn clone(&self) -> MessagesRing
fn clone(&self) -> MessagesRing
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 MessagesRing
impl Debug for MessagesRing
Auto Trait Implementations§
impl Freeze for MessagesRing
impl RefUnwindSafe for MessagesRing
impl Send for MessagesRing
impl Sync for MessagesRing
impl Unpin for MessagesRing
impl UnsafeUnpin for MessagesRing
impl UnwindSafe for MessagesRing
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