Skip to main content

BufferTextProvider

Trait BufferTextProvider 

Source
pub trait BufferTextProvider:
    Send
    + Sync
    + 'static
    + Debug {
    // Required method
    fn buffer_rope(&self, id: BufferId) -> Option<Rope>;
}
Expand description

One-trait seam between the diff subsystem and the host’s buffer storage. Required for BufferSource to resolve a BufferId to its live rope at snapshot time.

The host supplies a single impl backed by BufferRegistry. Future ephemeral-buffer providers (e.g. plugin-owned virtual buffers, AI-proposed-edits views) plug into the same trait.

buffer_rope(id) returns None when the buffer has been dropped. BufferSource treats None as an empty rope so a recompute against a closed buffer still produces a well-defined HunkIndex (all-Add or all-Remove depending on which slot was the dropped buffer) rather than panicking. The session’s drop_session lifecycle will remove the entry shortly after.

Required Methods§

Source

fn buffer_rope(&self, id: BufferId) -> Option<Rope>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§