Skip to main content

ProjectionAdapter

Trait ProjectionAdapter 

Source
pub trait ProjectionAdapter: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn project(
        &self,
        key: &ProjectionKey,
        ctx_data: &Value,
    ) -> Result<ProjectionRef, ProjectionError>;
    fn fetch(&self, key: &ProjectionKey) -> Result<Value, ProjectionError>;
    fn pointer_line(&self, r: &ProjectionRef) -> String;
}
Expand description

Context projection supply abstraction. The single source of truth is the run ctx passed into Self::project; an adapter only decides how the pull is served (module doc has the full narrative).

Required Methods§

Source

fn name(&self) -> &'static str

Stable adapter name ("file" / "mcp-query"), used in log lines and diagnostics.

Source

fn project( &self, key: &ProjectionKey, ctx_data: &Value, ) -> Result<ProjectionRef, ProjectionError>

Projects the slice of ctx_data addressed by key and returns a locator a worker can later Self::fetch. ctx_data is the policy-filtered ctx data slice this projection is drawn from — the adapter never mutates it.

Source

fn fetch(&self, key: &ProjectionKey) -> Result<Value, ProjectionError>

Pulls the value addressed by key directly, without going through a previously returned ProjectionRef locator.

Source

fn pointer_line(&self, r: &ProjectionRef) -> String

Renders the 1-3 line pointer this adapter’s ProjectionRef contributes to the directive header. Must never embed the projected value itself (inline full-embed is the exact problem projection exists to avoid — see the module doc).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§