humster 0.0.2

Modern music toolkit for Rust
Documentation
use std::fmt;

/// Library result type used across the crate.
pub type Result<T> = std::result::Result<T, Error>;

/// Simple error type covering I/O and parsing failures.
#[derive(Debug)]
pub enum Error {
    Io(std::io::Error),
    Parse(String),
}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Error::Io(err) => write!(f, "io error: {err}"),
            Error::Parse(message) => write!(f, "parse error: {message}"),
        }
    }
}

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

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