Skip to main content

Module content

Module content 

Source
Expand description

Per-document text content. Arc-shareable across multiple crate::View views.

Buffer owns everything that belongs to the document itself:

  • The text rope (text content).
  • The dirty_gen render-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::View views of the same file. Wrap in Arc<Mutex<Buffer>> and pass to crate::View::new_view to create an additional window onto the same content.