travsr-plugin-protocol 0.6.0

Travsr plugin wire protocol — Plugin trait, message types, and frame codec
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::types::{InvokeRequest, InvokeResponse, ParseRequest, ParseResponse};
use travsr_core::Language;

/// Implemented once per language. Stateless and Send+Sync so a single instance
/// is shared across walker threads (in-process) or drives one child process (sidecar).
pub trait Plugin: Send + Sync {
    fn language(&self) -> Language;
    fn extensions(&self) -> &[&str];
    fn supports_phase_b(&self) -> bool {
        false
    }
    fn parse(&self, req: &ParseRequest) -> ParseResponse;
    fn invoke_phase_b(&self, _req: &InvokeRequest) -> InvokeResponse {
        InvokeResponse::unsupported()
    }
}