Skip to main content

FoldSource

Trait FoldSource 

Source
pub trait FoldSource: Send + Sync {
    // Required methods
    fn id(&self) -> ProviderId;
    fn compute_folds(&self) -> Vec<Fold>;
}
Expand description

Data-only fold source for subsystems that live below lattice-host (e.g. ExcerptFoldProvider in lattice-multibuffer). Implementors cannot depend on FoldContext or FoldProvider (both defined in lattice-host). FoldSourceAdapter in lattice-host::fold_provider wraps any FoldSource as a FoldProvider by delegating compute() to compute_folds and ignoring FoldContext.

Slice: M.7.

Required Methods§

Source

fn id(&self) -> ProviderId

This source’s stable id: the same on every call, and distinct from every other registered source’s (see ProviderId).

Source

fn compute_folds(&self) -> Vec<Fold>

Produce the current fold ranges. Called by the host on recompute, so it should be cheap (read already-computed state; no I/O).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§