daaki-message 0.1.0

RFC 5322 email message parser and builder
Documentation
//! Typed error enum for email message parsing and building.
//!
//! # References
//! - RFC 5322 (Internet Message Format)
//! - RFC 2045–2047 (MIME)

/// Errors that can occur during email message parsing or building.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// Empty input provided to the parser.
    #[error("empty input: no message bytes provided")]
    EmptyInput,

    /// Missing required `From` header (RFC 5322 Section 3.6.2).
    #[error("missing required From header (RFC 5322 Section 3.6.2)")]
    MissingFrom,

    /// Date header could not be parsed per RFC 5322 Section 3.3.
    #[error("invalid date: {0}")]
    InvalidDate(String),

    /// Syntactically invalid email address (RFC 5322 Section 3.4).
    #[error("invalid email address: {0}")]
    InvalidAddress(String),

    /// Error during message building.
    #[error("build error: {0}")]
    Build(String),
}