From 17f266b0321ad4f58ecfd8b00f8487f47f819745 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Sun, 1 Dec 2024 08:57:43 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Code=20tweak?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/component.rs | 2 +- src/core/component/context.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/component.rs b/src/core/component.rs index d45e3f1f..5a02ee0e 100644 --- a/src/core/component.rs +++ b/src/core/component.rs @@ -1,5 +1,5 @@ mod context; -pub use context::{AssetsOp, Context, ParamError}; +pub use context::{AssetsOp, Context, ErrorParam}; pub type FnContextualPath = fn(cx: &Context) -> &str; mod definition; diff --git a/src/core/component/context.rs b/src/core/component/context.rs index 70bf2859..d1d4d955 100644 --- a/src/core/component/context.rs +++ b/src/core/component/context.rs @@ -30,21 +30,21 @@ pub enum AssetsOp { } #[derive(Debug)] -pub enum ParamError { +pub enum ErrorParam { NotFound, ParseError(String), } -impl fmt::Display for ParamError { +impl fmt::Display for ErrorParam { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - ParamError::NotFound => write!(f, "Parameter not found"), - ParamError::ParseError(e) => write!(f, "Parse error: {e}"), + ErrorParam::NotFound => write!(f, "Parameter not found"), + ErrorParam::ParseError(e) => write!(f, "Parse error: {e}"), } } } -impl Error for ParamError {} +impl Error for ErrorParam {} #[rustfmt::skip] pub struct Context { @@ -147,11 +147,11 @@ impl Context { &self.regions } - pub fn get_param(&self, key: &'static str) -> Result { + pub fn get_param(&self, key: &'static str) -> Result { self.params .get(key) - .ok_or(ParamError::NotFound) - .and_then(|v| T::from_str(v).map_err(|_| ParamError::ParseError(v.clone()))) + .ok_or(ErrorParam::NotFound) + .and_then(|v| T::from_str(v).map_err(|_| ErrorParam::ParseError(v.clone()))) } // Context PREPARE.