Skip to main content

Module content

Module content 

Source
Expand description

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

Content owns everything that belongs to the document itself:

  • The lines rope (text content).
  • The dirty_gen render-cache generation counter.
  • Manual folds (folds).

crate::Buffer is the per-window wrapper. It holds an Arc<Mutex<Content>> plus the per-window cursor. Two Buffer instances that share one Content see the same text and folds, but each moves its cursor independently.

§Concurrency

Held inside Arc<Mutex<Content>> so multiple Buffer 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§

Content
Per-document state shared across all crate::Buffer views of the same file. Wrap in Arc<Mutex<Content>> and pass to crate::Buffer::new_view to create an additional window onto the same content.