Skip to main content

CandidateAnnotator

Trait CandidateAnnotator 

Source
pub trait CandidateAnnotator: Send + Sync {
    // Required method
    fn annotate(&self, candidate: &mut RenderedCandidate);
}
Expand description

Decorates a candidate with display metadata (right-side text in the popup – marginalia’s role). Multiple annotators are active simultaneously; they run in registration order, each appending a typed crate::Annotation to candidate.annotations. The renderer paints each annotation with the style its category resolves to and joins consecutive annotations with two spaces.

MARG.1 (2026-06-03): annotation payload is now typed (Vec<Annotation>, not Vec<String>). Annotators choose the variant that matches the semantic — Annotation::Kind for category labels, Annotation::DocSnippet for inline docs, Annotation::Keybinding for bound chords (MARG.2), etc. The Custom { text, slot } escape hatch covers extensions that don’t fit a built-in variant.

Run order is registration order in v1. A future priority: i32 field will allow plugins to slot themselves between built-in annotators when the registration-order constraint becomes limiting.

Required Methods§

Source

fn annotate(&self, candidate: &mut RenderedCandidate)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§