lazippy 0.0.1

Pure-Rust LZMA (Lempel-Ziv-Markov chain Algorithm), part of the 8z umbrella
Documentation
//! LZMA match decoder stub.

use crate::error::{LazippyError, LazippyResult};

/// A decoded match (length + distance pair).
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Match {
    /// Copy length in bytes.
    pub length: u32,
    /// Backward distance into the dictionary.
    pub distance: u32,
}

/// Decode a match token from the LZMA stream.
///
/// # Errors
/// Always returns [`LazippyError::NotYetImplemented`] until the match decoder lands.
pub fn decode_match(_input: &[u8], _pos: &mut usize) -> LazippyResult<Match> {
    Err(LazippyError::NotYetImplemented)
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn decode_match_is_stub() {
        let mut pos = 0usize;
        let result = decode_match(&[], &mut pos);
        assert!(
            matches!(result, Err(LazippyError::NotYetImplemented)),
            "expected NotYetImplemented, got {result:?}"
        );
    }
}