Skip to main content

RopeStore

Struct RopeStore 

Source
pub struct RopeStore {
Show 13 fields pub rope: RwLock<Rope>, pub roots: RwLock<HashMap<EntityId, Root>>, pub documents: RwLock<HashMap<EntityId, Document>>, pub frames: RwLock<HashMap<EntityId, Frame>>, pub blocks: RwLock<HashMap<EntityId, Block>>, pub lists: RwLock<HashMap<EntityId, List>>, pub resources: RwLock<HashMap<EntityId, Resource>>, pub tables: RwLock<HashMap<EntityId, Table>>, pub table_cells: RwLock<HashMap<EntityId, TableCell>>, pub format_runs: RwLock<HashMap<EntityId, Vec<FormatRun>>>, pub block_images: RwLock<HashMap<EntityId, Vec<ImageAnchor>>>, pub block_offsets: RwLock<BlockOffsetIndex>, pub counters: RwLock<HashMap<String, EntityId>>, /* private fields */
}

Fields§

§rope: RwLock<Rope>§roots: RwLock<HashMap<EntityId, Root>>§documents: RwLock<HashMap<EntityId, Document>>§frames: RwLock<HashMap<EntityId, Frame>>§blocks: RwLock<HashMap<EntityId, Block>>§lists: RwLock<HashMap<EntityId, List>>§resources: RwLock<HashMap<EntityId, Resource>>§tables: RwLock<HashMap<EntityId, Table>>§table_cells: RwLock<HashMap<EntityId, TableCell>>§format_runs: RwLock<HashMap<EntityId, Vec<FormatRun>>>§block_images: RwLock<HashMap<EntityId, Vec<ImageAnchor>>>§block_offsets: RwLock<BlockOffsetIndex>§counters: RwLock<HashMap<String, EntityId>>

Implementations§

Source§

impl RopeStore

Source

pub fn new() -> Self

Source

pub fn snapshot(&self) -> RopeStoreSnapshot

O(1) snapshot of the entire store (rope is Arc-shared, all im::HashMaps are HAMT-shared; BlockOffsetIndex is a small Vec cloned outright).

Source

pub fn restore(&self, snap: &RopeStoreSnapshot)

Restore from a snapshot. Overwrites counters too — used for transaction rollback (Drop of an uncommitted write txn).

Source

pub fn restore_without_counters(&self, snap: &RopeStoreSnapshot)

Restore everything except counters — used for undo, where IDs must remain monotonically increasing across undo/redo cycles.

Source

pub fn create_savepoint(&self) -> u64

Source

pub fn restore_savepoint(&self, savepoint_id: u64)

Source

pub fn discard_savepoint(&self, savepoint_id: u64)

Source

pub fn store_snapshot(&self) -> StoreSnapshot

Type-erased store snapshot (for the generic undo path).

Source

pub fn restore_store_snapshot(&self, snap: &StoreSnapshot)

Restore from a type-erased store snapshot (undo semantic — counters preserved).

Trait Implementations§

Source§

impl Debug for RopeStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RopeStore

Source§

fn default() -> RopeStore

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.