use std::fmt;
mod helpers;
pub mod pkgbuild;
pub mod pkgdata;
#[derive(Debug, PartialEq, Eq)]
#[non_exhaustive]
#[allow(clippy::upper_case_acronyms)]
pub enum ErrorKind {
ValidationError,
ParseError,
InvalidPKGBUILDError,
}
impl fmt::Display for ErrorKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self)
}
}
#[derive(Debug, PartialEq, Eq)]
pub struct Error {
pub kind: ErrorKind,
pub msg: String,
}
impl Error {
pub fn new(kind: ErrorKind, msg: &str) -> Error {
Error {
kind,
msg: msg.to_string(),
}
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}: {}", self.kind, self.msg)
}
}