From 5e276d65f4e1f154106ed0d098c6fe95b91c4746 Mon Sep 17 00:00:00 2001 From: p0lunin Date: Sat, 6 Jun 2020 20:50:59 +0300 Subject: [PATCH] refactoring --- src/utils/command.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/command.rs b/src/utils/command.rs index d9714e16..4b7fb4fa 100644 --- a/src/utils/command.rs +++ b/src/utils/command.rs @@ -194,6 +194,9 @@ pub trait BotCommand: Sized { N: Into; } +pub type PrefixedBotCommand = String; +pub type BotName = String; + /// Errors returned from [`BotCommand::parse`]. /// /// [`BotCommand::parse`]: crate::utils::command::BotCommand::parse @@ -215,8 +218,8 @@ pub enum ParseError { /// [`FromStr::from_str`]: https://doc.rust-lang.org/std/str/trait.FromStr.html#tymethod.from_str IncorrectFormat, - UnknownCommand(String), - WrongBotName(String), + UnknownCommand(PrefixedBotCommand), + WrongBotName(BotName), /// A custom error which you can return from your custom parser. Custom(Box),