pub struct BufferStore { /* private fields */ }Expand description
Server-wide buffer store.
Buffers are server-global state, not session-keyed. Unnamed buffers use
deterministic names (buffer0, buffer1, …) from a monotonically
increasing sequence. The allocator skips names already occupied by existing
buffers, including explicit named buffers. FIFO eviction at the effective
buffer-limit removes only unnamed buffers.
Implementations§
Source§impl BufferStore
impl BufferStore
Sourcepub fn stack_head(&self) -> Option<&str>
pub fn stack_head(&self) -> Option<&str>
Returns the name of the stack-head buffer (most recently created/replaced).
Sourcepub fn top_unnamed(&self) -> Option<&str>
pub fn top_unnamed(&self) -> Option<&str>
Returns the name of the most recent automatic buffer.
Sourcepub fn get(&self, name: &str) -> Option<&[u8]>
pub fn get(&self, name: &str) -> Option<&[u8]>
Returns the content of the named buffer, or None if it does not exist.
Sourcepub fn set(
&mut self,
name: Option<&str>,
content: Vec<u8>,
buffer_limit: usize,
) -> Result<SetBufferOutcome, RmuxError>
pub fn set( &mut self, name: Option<&str>, content: Vec<u8>, buffer_limit: usize, ) -> Result<SetBufferOutcome, RmuxError>
Sets a named buffer, replacing it if it already exists.
When name is Some, the buffer is created or replaced with that name.
When name is None, a new unnamed buffer is created with the next
deterministic name.
Zero-length content succeeds without creating or replacing any buffer.
Returns a list of buffer names evicted by FIFO unnamed eviction (may be empty), followed by the optional name of the created/replaced buffer.
Sourcepub fn rename(
&mut self,
old_name: Option<&str>,
new_name: &str,
) -> Result<RenameBufferOutcome, RmuxError>
pub fn rename( &mut self, old_name: Option<&str>, new_name: &str, ) -> Result<RenameBufferOutcome, RmuxError>
Renames a buffer, replacing any existing destination buffer.
Sourcepub fn delete(&mut self, name: Option<&str>) -> Result<String, RmuxError>
pub fn delete(&mut self, name: Option<&str>) -> Result<String, RmuxError>
Deletes a buffer by name.
When name is None, deletes the most recent automatic buffer.
Returns the name of the deleted buffer.
Sourcepub fn delete_if_order_matches(&mut self, name: &str, order: u64) -> bool
pub fn delete_if_order_matches(&mut self, name: &str, order: u64) -> bool
Deletes a buffer only when the current entry still matches order.
Returns true when the matching entry was removed. Returns false
when the buffer is absent or has since been replaced.
Sourcepub fn show(&self, name: Option<&str>) -> Result<(&str, &[u8]), RmuxError>
pub fn show(&self, name: Option<&str>) -> Result<(&str, &[u8]), RmuxError>
Returns the content of a buffer by name, or the most recent automatic
buffer when name is None.
Sourcepub fn show_with_order(
&self,
name: Option<&str>,
) -> Result<(&str, &[u8], u64), RmuxError>
pub fn show_with_order( &self, name: Option<&str>, ) -> Result<(&str, &[u8], u64), RmuxError>
Returns the content and current replacement order for a buffer.
Sourcepub fn entries(&self) -> Vec<BufferView<'_>>
pub fn entries(&self) -> Vec<BufferView<'_>>
Returns immutable buffer entries for server-side formatting and sorting.
Trait Implementations§
Source§impl Clone for BufferStore
impl Clone for BufferStore
Source§fn clone(&self) -> BufferStore
fn clone(&self) -> BufferStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more