Skip to main content

Source

Trait Source 

Source
pub trait Source {
    type Raw: DeserializeOwned;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn id(&self) -> SourceId;
    fn endpoint(&self) -> &Url;
    fn parse(&self, raw: &str) -> Result<Self::Raw, Self::Error>;
    fn to_evidence(
        &self,
        raw: Self::Raw,
        model: &ModelId,
    ) -> Result<Vec<Evidence>, Self::Error>;
}
Expand description

The Source trait: each upstream source implements this.

Sources are pure: they parse and convert without performing I/O. This allows adapters to be tested against frozen fixtures without network access.

Required Associated Types§

Source

type Raw: DeserializeOwned

The native schema for this source’s upstream data.

Source

type Error: Error + Send + Sync + 'static

Error type for parse/to_evidence failures.

Required Methods§

Source

fn id(&self) -> SourceId

Stable identifier for this source (e.g., “arc-agi-3”).

Source

fn endpoint(&self) -> &Url

The URL or endpoint this source ingests from.

Source

fn parse(&self, raw: &str) -> Result<Self::Raw, Self::Error>

Parse raw upstream data (JSON string) into the typed schema. Fails closed on any malformed input.

Source

fn to_evidence( &self, raw: Self::Raw, model: &ModelId, ) -> Result<Vec<Evidence>, Self::Error>

Convert validated raw data into agi4-core Evidence values. One source may produce evidence for multiple conjuncts (e.g., ARC-AGI-3 contributes to both Generality and EnvironmentalTransfer).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§