Skip to main content

SidecarCache

Trait SidecarCache 

Source
pub trait SidecarCache:
    Serialize
    + DeserializeOwned
    + Sized {
    const EXTENSION: &str;

    // Provided methods
    fn cache_path_for<P: AsRef<Path>>(fasta_path: P) -> PathBuf { ... }
    fn write<P: AsRef<Path>>(&self, fasta_path: P) -> StoreResult<PathBuf> { ... }
    fn load_if_fresh<P: AsRef<Path>>(fasta_path: P) -> Option<Self> { ... }
}
Expand description

Trait for FASTA sidecar cache files (e.g. .refget.json, .seqcol.json).

Provides default implementations for cache_path_for, write, and load_if_fresh based on the cache file extension.

Required Associated Constants§

Source

const EXTENSION: &str

The sidecar file extension (e.g. "refget.json", "seqcol.json").

Provided Methods§

Source

fn cache_path_for<P: AsRef<Path>>(fasta_path: P) -> PathBuf

Return the standard cache path for a given FASTA file.

Source

fn write<P: AsRef<Path>>(&self, fasta_path: P) -> StoreResult<PathBuf>

Write the cache to its standard sidecar path.

Source

fn load_if_fresh<P: AsRef<Path>>(fasta_path: P) -> Option<Self>

Try to load a cache file for the given FASTA, returning None if the cache is missing or stale (older than the FASTA or its index).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl SidecarCache for DigestCache

Source§

const EXTENSION: &str = "refget.json"

Source§

impl SidecarCache for SeqColCache

Source§

const EXTENSION: &str = "seqcol.json"