pub struct DocumentSnapshot {
pub id: DocumentId,
pub version: u64,
pub text_version: u64,
pub buffer: Buffer,
pub path: Option<Arc<PathBuf>>,
pub dirty: bool,
pub selections: Arc<SelectionSet>,
}Expand description
One immutable snapshot of a document. Cheap to clone (every
non-trivial field is already Arc-shareable internally;
Buffer wraps a ropey::Rope whose interior is a B-tree of
Arcs, so cloning is O(log n) with no heap allocation in the
common case).
Fields§
§id: DocumentId§version: u64Bumps on any commit (edits, undo, redo, set_path, mark_clean).
text_version: u64Bumps only on text-mutating commits. Used by the syntax cache to decide whether to reparse.
buffer: Buffer§path: Option<Arc<PathBuf>>Arc<PathBuf> so cloning a snapshot doesn’t clone the path
string. None means an unsaved buffer (*scratch*-style).
dirty: boolTrue iff the buffer differs from its on-disk state. Tracked by the document’s clean-position bookkeeping; the snapshot just reflects the current value.
selections: Arc<SelectionSet>Arc<SelectionSet> so cloning a snapshot doesn’t clone the
selection vector. v1 single-cursor: this is always one
charwise selection; multi-cursor support folds in here when
it lands.
Implementations§
Trait Implementations§
Source§impl Clone for DocumentSnapshot
impl Clone for DocumentSnapshot
Source§fn clone(&self) -> DocumentSnapshot
fn clone(&self) -> DocumentSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more