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§
Required Methods§
Sourcefn generation(&self) -> Generation
fn generation(&self) -> Generation
Current monotonic generation. Increases on every successful rescan.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn subscribe(&self) -> GenerationEventStream
fn subscribe(&self) -> GenerationEventStream
Subscribe to generation-change notifications.
Sourcefn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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".