Struct loro_internal::arena::SharedArena
source · pub struct SharedArena { /* private fields */ }Expand description
This is shared between [OpLog] and [AppState].
Implementations§
pub fn register_container(&self, id: &ContainerID) -> ContainerIdx
pub fn get_container_id(&self, idx: ContainerIdx) -> Option<ContainerID>
pub fn id_to_idx(&self, id: &ContainerID) -> Option<ContainerIdx>
pub fn idx_to_id(&self, id: ContainerIdx) -> Option<ContainerID>
pub fn with_idx_to_id<R>(&self, f: impl FnOnce(&Vec<ContainerID>) -> R) -> R
pub fn alloc_str(&self, str: &str) -> StrAllocResult
sourcepub fn alloc_str_with_slice(&self, str: &str) -> (BytesSlice, usize)
pub fn alloc_str_with_slice(&self, str: &str) -> (BytesSlice, usize)
return slice and unicode index
sourcepub fn alloc_str_fast(&self, bytes: &[u8])
pub fn alloc_str_fast(&self, bytes: &[u8])
alloc str without extra info
pub fn utf16_len(&self) -> usize
pub fn alloc_value(&self, value: LoroValue) -> usize
pub fn alloc_values( &self, values: impl Iterator<Item = LoroValue> ) -> Range<usize>
pub fn set_parent(&self, child: ContainerIdx, parent: Option<ContainerIdx>)
pub fn log_hierarchy(&self)
pub fn get_parent(&self, child: ContainerIdx) -> Option<ContainerIdx>
sourcepub fn with_ancestors(
&self,
container: ContainerIdx,
f: impl FnMut(ContainerIdx, bool)
)
pub fn with_ancestors( &self, container: ContainerIdx, f: impl FnMut(ContainerIdx, bool) )
Call f on each ancestor of container, including container itself.
f(ContainerIdx, is_first)
pub fn slice_by_unicode(&self, range: impl RangeBounds<usize>) -> BytesSlice
pub fn slice_by_utf8(&self, range: impl RangeBounds<usize>) -> BytesSlice
pub fn slice_str_by_unicode_range(&self, range: Range<usize>) -> String
pub fn with_text_slice(&self, range: Range<usize>, f: impl FnMut(&str))
pub fn get_value(&self, idx: usize) -> Option<LoroValue>
pub fn get_values(&self, range: Range<usize>) -> Vec<LoroValue>
pub fn convert_single_op( &self, container: &ContainerID, peer: PeerID, counter: Counter, lamport: Lamport, content: RawOpContent<'_> ) -> Op
pub fn can_import_snapshot(&self) -> bool
pub fn convert_raw_op(&self, op: &RawOp<'_>) -> Op
pub fn export_containers(&self) -> Vec<ContainerID>
pub fn export_parents(&self) -> Vec<Option<ContainerIdx>>
pub fn root_containers(&self) -> Vec<ContainerIdx>
Trait Implementations§
source§fn clone(&self) -> SharedArena
fn clone(&self) -> SharedArena
Returns a copy 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 moresource§fn default() -> SharedArena
fn default() -> SharedArena
Returns the “default value” for a type. Read more
Auto Trait Implementations§
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