termal-alignment 0.2.0

Alignment parsing and metrics for the termal multiple-sequence-alignment viewer
Documentation
// SPDX-License-Identifier: MIT
// Copyright (c) 2025-2026 Thomas Junier

use std::fmt;

#[derive(Debug)]
pub enum AlignmentError {
    Io(std::io::Error),
    Parse { msg: String },
    InvalidFormat { msg: String },
}

impl fmt::Display for AlignmentError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            AlignmentError::Io(e) => write!(f, "I/O error: {e}"),
            AlignmentError::Parse { msg } => write!(f, "Parse error: {msg}"),
            AlignmentError::InvalidFormat { msg } => write!(f, "Invalid format: {msg}"),
        }
    }
}

impl std::error::Error for AlignmentError {}

impl From<std::io::Error> for AlignmentError {
    fn from(e: std::io::Error) -> Self {
        AlignmentError::Io(e)
    }
}