pub struct ActiveDocument(/* private fields */);Expand description
M.0 (2026-05-31): the active-document slot held by
Editor.document. Wraps an Arc<dyn Document> so that:
-
The slot can hold either a regular rope-backed handle (today:
RopeDocumentHandle, renamed toRopeDocumentHandlein M.0 Phase E) or aMultibufferDocumentHandle(M.1) without kind-branching at the use site — dispatch / motion / render code paths just callDocumenttrait methods throughDeref<Target = dyn Document>. -
The slot impls
Default(initialised to a placeholder rope handle viaRopeDocumentHandle::default()) so consumers that#[derive(Default)]over a struct containing this field work without hand-rolling the impl. The placeholder’s actor receiver is closed immediately at construction, so any traffic sent through the placeholder reportsRuntimeError::ActorGone— production code overwrites the slot before any real traffic flows. -
The newtype is cheap to clone (one atomic refcount bump on the inner
Arc).
Arc<dyn Document> directly cannot implement Default
(orphan rule on Arc + dyn Trait: !Sized), so this
newtype is the smallest viable wrapper that keeps the
derive ergonomics intact without forcing a manual
impl Default over every struct that holds the slot.
Implementations§
Source§impl ActiveDocument
impl ActiveDocument
Sourcepub fn new<D: Document>(handle: D) -> Self
pub fn new<D: Document>(handle: D) -> Self
Wrap a concrete document handle. The handle must impl
Document (today: RopeDocumentHandle / future
RopeDocumentHandle; M.1: MultibufferDocumentHandle).
Trait Implementations§
Source§impl Clone for ActiveDocument
impl Clone for ActiveDocument
Source§fn clone(&self) -> ActiveDocument
fn clone(&self) -> ActiveDocument
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more