Skip to main content

BeholderFactory

Trait BeholderFactory 

Source
pub trait BeholderFactory: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn version(&self) -> &'static str;
    fn matches(&self, resolved_argv: &[String]) -> bool;
    fn mode(&self) -> BeholderMode;
    fn create(&self) -> Box<dyn Beholder>;

    // Provided method
    fn tool_version_range(&self) -> Option<ToolVersionRange> { ... }
}
Expand description

Static descriptor + factory for a beholder type. Held in the registry.

create() produces a fresh, independent per-run instance each time. Implementors should be stateless — all per-run state belongs in the instance returned by create.

Required Methods§

Source

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

Source

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

Source

fn matches(&self, resolved_argv: &[String]) -> bool

Return true if this beholder handles the given invocation.

Receives the resolved argv (wrappers stripped). May inspect argv to detect user-set conflicting flags (e.g. --message-format=human) and return false to decline gracefully.

Source

fn mode(&self) -> BeholderMode

Source

fn create(&self) -> Box<dyn Beholder>

Create a fresh per-run instance.

Provided Methods§

Source

fn tool_version_range(&self) -> Option<ToolVersionRange>

Declared support range for the underlying tool’s structured output format.

Informational: surfaced in beholder_status when format drift is detected so agents can see which version window the beholder was built for. None means the beholder makes no version claim.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§