pub struct MemoryBlock { /* private fields */ }Expand description
A single memory block.
TigerStyle: Immutable content with explicit size tracking.
Implementations§
Source§impl MemoryBlock
impl MemoryBlock
Sourcepub fn new(
block_type: MemoryBlockType,
content: impl Into<String>,
now_ms: u64,
) -> Self
pub fn new( block_type: MemoryBlockType, content: impl Into<String>, now_ms: u64, ) -> Self
Create a new memory block.
§Panics
Panics if content exceeds CORE_MEMORY_BLOCK_SIZE_BYTES_MAX.
Panics if label exceeds CORE_MEMORY_BLOCK_LABEL_BYTES_MAX.
Sourcepub fn with_label(
block_type: MemoryBlockType,
label: impl Into<String>,
content: impl Into<String>,
now_ms: u64,
) -> Self
pub fn with_label( block_type: MemoryBlockType, label: impl Into<String>, content: impl Into<String>, now_ms: u64, ) -> Self
Create a new memory block with a label.
§Panics
Panics if content exceeds CORE_MEMORY_BLOCK_SIZE_BYTES_MAX.
Panics if label exceeds CORE_MEMORY_BLOCK_LABEL_BYTES_MAX.
Sourcepub fn id(&self) -> MemoryBlockId
pub fn id(&self) -> MemoryBlockId
Get the block ID.
Sourcepub fn block_type(&self) -> MemoryBlockType
pub fn block_type(&self) -> MemoryBlockType
Get the block type.
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Get the size in bytes (cached).
Sourcepub fn created_at_ms(&self) -> u64
pub fn created_at_ms(&self) -> u64
Get creation timestamp.
Sourcepub fn modified_at_ms(&self) -> u64
pub fn modified_at_ms(&self) -> u64
Get modification timestamp.
Sourcepub fn set_content(&mut self, content: impl Into<String>, now_ms: u64)
pub fn set_content(&mut self, content: impl Into<String>, now_ms: u64)
Trait Implementations§
Source§impl Clone for MemoryBlock
impl Clone for MemoryBlock
Source§fn clone(&self) -> MemoryBlock
fn clone(&self) -> MemoryBlock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MemoryBlock
impl RefUnwindSafe for MemoryBlock
impl Send for MemoryBlock
impl Sync for MemoryBlock
impl Unpin for MemoryBlock
impl UnwindSafe for MemoryBlock
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