Skip to main content

ResolveTestArtifact

Trait ResolveTestArtifact 

Source
pub trait ResolveTestArtifact {
    // Required method
    fn resolve(&self, id: ErasedArtifactHandle) -> Result<PathBuf>;

    // Provided method
    fn resolve_source(&self, id: ErasedArtifactHandle) -> Result<ArtifactSource> { ... }
}
Expand description

A trait to resolve artifacts to paths.

Test authors are expected to use the TestArtifactRequirements and TestArtifacts abstractions to interact with artifacts, and should not use this API directly.

Required Methods§

Source

fn resolve(&self, id: ErasedArtifactHandle) -> Result<PathBuf>

Given an artifact handle, return its corresponding PathBuf.

This method must use type-erased handles, as using typed artifact handles in this API would cause the trait to no longer be object-safe.

Provided Methods§

Source

fn resolve_source(&self, id: ErasedArtifactHandle) -> Result<ArtifactSource>

Given an artifact handle, return its source (local path or remote URL).

The default implementation wraps the result of resolve in ArtifactSource::Local. Override this to return ArtifactSource::Remote for artifacts that are available at a URL but not downloaded locally.

Implementations on Foreign Types§

Source§

impl<T: ResolveTestArtifact + ?Sized> ResolveTestArtifact for &T

Implementors§