feat: Added impl_path field to Config struct

- Also clarified error::Error enum
This commit is contained in:
Alexey 2025-12-09 14:16:23 +03:00
commit 1142fe6ad9
2 changed files with 10 additions and 5 deletions

View file

@ -24,6 +24,9 @@ pub struct Config {
/// If true, print to std{out/err}
pub verbose: bool,
/// Path to implementation config file
pub impl_path: Option<PathBuf>,
}
impl Default for Config {
@ -34,6 +37,7 @@ impl Default for Config {
accounts_path: "accounts".into(),
map: "map.toml".into(),
verbose: true,
impl_path: None,
}
}
}

View file

@ -2,7 +2,8 @@
use std::{fmt, path::PathBuf};
/// Error struct
/// Error enum, which acts as different Error structs wrapper,
/// while also handling some other errors
#[derive(Debug)]
#[non_exhaustive]
pub enum Error {
@ -19,10 +20,10 @@ pub enum Error {
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::IsNotAFile(path) => write!(f, "{:?} is not a file", path),
Error::IoError(error) => write!(f, "io error: {error}"),
Error::TomlSerializeError(error) => write!(f, "serialize error: {error}"),
Error::TomlDeserializeError(error) => write!(f, "parse error: {error}")
Self::IsNotAFile(path) => write!(f, "{path:?} is not a file"),
Self::IoError(error) => write!(f, "{error}"),
Self::TomlSerializeError(error) => write!(f, "{error}"),
Self::TomlDeserializeError(error) => write!(f, "{error}"),
}
}
}