Skip to main content

ArtifactBackend

Trait ArtifactBackend 

Source
pub trait ArtifactBackend: Send + Sync {
    // Required methods
    fn format(&self) -> ArtifactFormat;
    fn detects(&self, bytes: &[u8]) -> bool;
    fn parse(&self, bytes: &[u8]) -> Result<ArtifactIr, ArtifactError>;
    fn capabilities(&self) -> ArtifactCapabilities;
}
Expand description

Format-specific parser isolated behind a common Artifact IR boundary.

Required Methods§

Source

fn format(&self) -> ArtifactFormat

Format this backend accepts.

Source

fn detects(&self, bytes: &[u8]) -> bool

Whether bytes begin with this format’s magic number.

Source

fn parse(&self, bytes: &[u8]) -> Result<ArtifactIr, ArtifactError>

Parse bytes without executing the artifact.

§Errors

Returns ArtifactError::WrongFormat for input with another magic and ArtifactError::Malformed for a recognised but invalid input.

Source

fn capabilities(&self) -> ArtifactCapabilities

Facts this backend can potentially provide for a well-formed input.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§