From 7f53e38aeeda90e9537512ce7999dc8ca7e9a701 Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Sat, 4 May 2024 03:23:24 -0600 Subject: [PATCH] debug --- src/handler/mod.rs | 6 ++++++ src/handler/parent.rs | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/handler/mod.rs b/src/handler/mod.rs index 0ec5904..87d3604 100644 --- a/src/handler/mod.rs +++ b/src/handler/mod.rs @@ -1,5 +1,6 @@ use std::any::TypeId; use std::collections::VecDeque; +use std::fmt::Debug; use std::marker::PhantomData; use std::ops::Deref; use std::sync::Arc; @@ -147,6 +148,11 @@ impl Clone for DynHandler { Self(self.0.clone()) } } +impl Debug for DynHandler { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("DynHandler").finish() + } +} #[async_trait::async_trait] impl HandleAny for DynHandler diff --git a/src/handler/parent.rs b/src/handler/parent.rs index 217bce4..9356b27 100644 --- a/src/handler/parent.rs +++ b/src/handler/parent.rs @@ -1,4 +1,5 @@ use std::collections::VecDeque; +use std::fmt::Debug; use clap::{ArgMatches, Command, CommandFactory, FromArgMatches}; use imbl_value::imbl::OrdMap; @@ -28,6 +29,11 @@ impl Clone for SubcommandMap { Self(self.0.clone()) } } +impl Debug for SubcommandMap { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_map().entries(self.0.iter()).finish() + } +} impl SubcommandMap { fn insert(&mut self, name: Option<&'static str>, handler: DynHandler) { self.0.insert(Name(name), handler); @@ -73,7 +79,7 @@ impl std::fmt::Debug { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_tuple("ParentHandler") - // .field(&self.subcommands) + .field(&self.subcommands) .finish() } }