Expand description
Per-document text content. Arc-shareable across multiple crate::View
views.
Buffer owns everything that belongs to the document itself:
- The
textrope (text content). - The
dirty_genrender-cache generation counter. - Manual folds (
folds).
crate::View is the per-window wrapper. It holds an
Arc<Mutex<Buffer>> plus the per-window cursor. Two View
instances that share one Buffer see the same text and folds, but
each moves its cursor independently.
§Concurrency
Held inside Arc<Mutex<Buffer>> so multiple View views can share
one document safely. Mutex (not RefCell) because the engine’s
Cursor, Query, BufferEdit, and Search traits require Send,
and RefCell is !Send. Lock contention is near-zero in the
single-threaded app loop; the Mutex is essentially a free Send
adapter.
Structs§
- Buffer
- Per-document state shared across all
crate::Viewviews of the same file. Wrap inArc<Mutex<Buffer>>and pass tocrate::View::new_viewto create an additional window onto the same content.