diff --git a/src/framework/standard/command.rs b/src/framework/standard/command.rs index be7ec2aeda4..8afb583c8f4 100644 --- a/src/framework/standard/command.rs +++ b/src/framework/standard/command.rs @@ -17,6 +17,7 @@ pub type AfterHook = Fn(&mut Context, &Message, &str, Result<(), Error>) + Send pub(crate) type InternalCommand = Arc; pub type PrefixCheck = Fn(&mut Context, &Message) -> Option + Send + Sync + 'static; +#[derive(Debug)] pub enum CommandOrAlias { Alias(String), Command(InternalCommand), @@ -41,6 +42,7 @@ pub enum CommandType { WithCommands(Help), } +#[derive(Debug)] pub struct CommandGroup { pub prefix: Option, pub commands: HashMap, @@ -98,6 +100,25 @@ impl Command { } } +impl fmt::Debug for Command { + // TODO: add Command::checks somehow? + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_struct("Command") + .field("bucket", &self.bucket) + .field("desc", &self.desc) + .field("example", &self.example) + .field("usage", &self.usage) + .field("min_args", &self.min_args) + .field("required_permissions", &self.required_permissions) + .field("allowed_roles", &self.allowed_roles) + .field("help_available", &self.help_available) + .field("dm_only", &self.dm_only) + .field("guild_only", &self.guild_only) + .field("owners_only", &self.owners_only) + .finish() + } +} + impl Default for Command { fn default() -> Command { Command { diff --git a/src/framework/standard/create_command.rs b/src/framework/standard/create_command.rs index c1558ce31ce..4788a05fe4e 100644 --- a/src/framework/standard/create_command.rs +++ b/src/framework/standard/create_command.rs @@ -5,6 +5,7 @@ use std::sync::Arc; use client::Context; use model::{Message, Permissions}; +#[derive(Debug)] pub struct CreateCommand(pub Command); impl CreateCommand { diff --git a/src/internal/timer.rs b/src/internal/timer.rs index 6a8bf7485d3..68d817a1046 100644 --- a/src/internal/timer.rs +++ b/src/internal/timer.rs @@ -2,6 +2,7 @@ use chrono::{DateTime, Duration, Utc}; use std::thread; use std::time::Duration as StdDuration; +#[derive(Debug)] pub struct Timer { due: DateTime, duration: Duration, diff --git a/src/model/utils.rs b/src/model/utils.rs index fd103c0cc70..26ec7fe4de0 100644 --- a/src/model/utils.rs +++ b/src/model/utils.rs @@ -187,6 +187,7 @@ pub fn user_has_perms(channel_id: ChannelId, mut permissions: Permissions) -> Re Ok(permissions.is_empty()) } +#[derive(Debug)] pub struct U16Visitor; impl<'de> Visitor<'de> for U16Visitor { @@ -216,6 +217,7 @@ impl<'de> Visitor<'de> for U16Visitor { fn visit_u64(self, v: u64) -> StdResult { Ok(v as u16) } } +#[derive(Debug)] pub struct U64Visitor; impl<'de> Visitor<'de> for U64Visitor { diff --git a/src/utils/message_builder.rs b/src/utils/message_builder.rs index 284ba1e9699..c00cd0a41be 100644 --- a/src/utils/message_builder.rs +++ b/src/utils/message_builder.rs @@ -767,7 +767,7 @@ pub enum ContentModifier { } /// Describes formatting on string content -#[derive(Default, Clone)] +#[derive(Debug, Default, Clone)] pub struct Content { pub italic: bool, pub bold: bool, @@ -912,15 +912,15 @@ impl From for Content { mod private { use super::{Content, ContentModifier}; use std::fmt; - + pub trait A {} - + impl A for ContentModifier {} impl A for Content {} impl A for T {} } - + /// This trait only exists as way to bypass the shouting of the compiler. Specifically "conflicting /// implementations in core" and alike. /// However is not meant to be used outside. @@ -940,7 +940,7 @@ impl I for T { } } } - + impl I for ContentModifier { fn into(self) -> Content { self.to_content() } }