jellyfish-reader 0.1.0

Pure Rust reader for Jellyfish k-mer counting output files
Documentation
use std::io;

/// Errors that can occur when reading Jellyfish files.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// An I/O error occurred.
    #[error("I/O error: {0}")]
    Io(#[from] io::Error),

    /// The file header could not be parsed.
    #[error("invalid header: {0}")]
    InvalidHeader(String),

    /// The JSON in the header is malformed.
    #[error("invalid header JSON: {0}")]
    InvalidJson(#[from] serde_json::Error),

    /// The file format is not supported.
    #[error("unsupported format: {0}")]
    UnsupportedFormat(String),

    /// An invalid k-mer string was encountered.
    #[error("invalid k-mer: {0}")]
    InvalidKmer(String),

    /// The file is truncated or corrupted.
    #[error("unexpected end of file")]
    UnexpectedEof,

    /// A field is missing from the header.
    #[error("missing header field: {0}")]
    MissingField(String),
}

/// Result type alias for jellyfish-reader operations.
pub type Result<T> = std::result::Result<T, Error>;