Skip to main content

AcceptHandler

Trait AcceptHandler 

Source
pub trait AcceptHandler: Send + Sync {
    // Required method
    fn accept(&self, candidate: &RawCandidate) -> Result<AcceptAction, String>;
}
Expand description

Translate a chosen candidate into a typed action the host dispatches. Stateless: the handler reads the candidate, the host runs the action. State lookup for indexed variants (LSP completion / code-actions / etc.) happens at dispatch time inside the host, where Editor::pending_*_items is in scope.

See the design doc § “Implication: AcceptHandler is stateless” for the cross-check that validated this shape.

Return type. Result<AcceptAction, String> mirrors today’s PickerSourceGenerator::accept -> SourceResult<...>. Err flows to the host’s error echo; the source stays alive. Most picker sources will use DefaultAcceptHandler which reads RawCandidate::accept_action set at candidate-build time — the per-source impl is only needed when accept needs context-dependent transformation.

Required Methods§

Source

fn accept(&self, candidate: &RawCandidate) -> Result<AcceptAction, String>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§