romans 0.1.0

Utility to convert and represent Roman numerals.
Documentation
//! Main crate error

use crate::romans::symbol::Symbol;

#[derive(thiserror::Error, Debug, PartialEq)]

/// Standard library errors
pub enum Error {
    /// Generic error marker.
    #[error("generic error: {0}")]
    Generic(String),

    /// Invalid character found during string to symbol conversion.
    /// Only allowed Roman symbols as characters are I, V, X, L, C, D, M.
    /// Lowercase characters are converted to uppercase.
    #[error("invalid roman character: {0}")]
    InvalidRomanCharacter(char),

    /// Invalid sequence or repetition of symbol.
    #[error("invalid symbol sequence: previous={previous:?}, last={last:?}, repetitions={repetitions:?}")]
    InvalidSymbolSequence {
        /// Symbol found previously (before last) in the sequence
        previous: Symbol,
        /// Last symbol in the sequence
        last: Symbol,
        /// How many times the last symbol was seen, in total
        repetitions: u8,
    },
}