Skip to main content

EngineApi

Trait EngineApi 

Source
pub trait EngineApi:
    Send
    + Sync
    + 'static {
    type Report: Send + Sync + 'static;
    type Query: Send + Sync;
    type Error: StdError + Send + Sync + 'static;

    // Required methods
    fn generation(&self) -> Generation;
    fn report<'life0, 'async_trait>(
        &'life0 self,
        query: Self::Query,
        cancel: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<Snapshot<Self::Report>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn rescan<'life0, 'async_trait>(
        &'life0 self,
        scope: RescanScope,
        progress: Progress,
    ) -> Pin<Box<dyn Future<Output = Result<RescanTicket, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe(&self) -> GenerationEventStream;
    fn shutdown<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The contract every engine implementation satisfies.

One implementation is consumed by both the LSP server scaffolding in lspkit-server and the MCP adapter in lspkit-mcp. See spec.md for the full behavioral contract.

Required Associated Types§

Source

type Report: Send + Sync + 'static

Engine-defined report payload type.

Source

type Query: Send + Sync

Engine-defined query type. A report is computed for a given query.

Source

type Error: StdError + Send + Sync + 'static

Engine-defined error type.

Required Methods§

Source

fn generation(&self) -> Generation

Current monotonic generation. Increases on every successful rescan.

Source

fn report<'life0, 'async_trait>( &'life0 self, query: Self::Query, cancel: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<Snapshot<Self::Report>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Compute a report for query. MUST observe cancel and return a cancellation error within a bounded delay.

Source

fn rescan<'life0, 'async_trait>( &'life0 self, scope: RescanScope, progress: Progress, ) -> Pin<Box<dyn Future<Output = Result<RescanTicket, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Request a rescan of scope. Implementations MAY coalesce concurrent requests; progress MAY emit zero events.

Source

fn subscribe(&self) -> GenerationEventStream

Subscribe to generation-change notifications.

Source

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drain in-flight work, complete subscriber streams, and refuse further calls. After shutdown returns, every other method MUST return Self::Error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§