This commit is contained in:
Aiden McClelland
2024-05-04 03:23:24 -06:00
parent 00d3ab7e70
commit 7f53e38aee
2 changed files with 13 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
use std::any::TypeId; use std::any::TypeId;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::fmt::Debug;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::ops::Deref; use std::ops::Deref;
use std::sync::Arc; use std::sync::Arc;
@@ -147,6 +148,11 @@ impl<Context, Inherited> Clone for DynHandler<Context, Inherited> {
Self(self.0.clone()) Self(self.0.clone())
} }
} }
impl<Context, Inherited> Debug for DynHandler<Context, Inherited> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("DynHandler").finish()
}
}
#[async_trait::async_trait] #[async_trait::async_trait]
impl<Context: crate::Context, Inherited: Send> HandleAny<Context> impl<Context: crate::Context, Inherited: Send> HandleAny<Context>
for DynHandler<Context, Inherited> for DynHandler<Context, Inherited>

View File

@@ -1,4 +1,5 @@
use std::collections::VecDeque; use std::collections::VecDeque;
use std::fmt::Debug;
use clap::{ArgMatches, Command, CommandFactory, FromArgMatches}; use clap::{ArgMatches, Command, CommandFactory, FromArgMatches};
use imbl_value::imbl::OrdMap; use imbl_value::imbl::OrdMap;
@@ -28,6 +29,11 @@ impl<Context, Inherited> Clone for SubcommandMap<Context, Inherited> {
Self(self.0.clone()) Self(self.0.clone())
} }
} }
impl<Context, Inherited> Debug for SubcommandMap<Context, Inherited> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_map().entries(self.0.iter()).finish()
}
}
impl<Context, Inherited> SubcommandMap<Context, Inherited> { impl<Context, Inherited> SubcommandMap<Context, Inherited> {
fn insert(&mut self, name: Option<&'static str>, handler: DynHandler<Context, Inherited>) { fn insert(&mut self, name: Option<&'static str>, handler: DynHandler<Context, Inherited>) {
self.0.insert(Name(name), handler); self.0.insert(Name(name), handler);
@@ -73,7 +79,7 @@ impl<Context, Params, InheritedParams> std::fmt::Debug
{ {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("ParentHandler") f.debug_tuple("ParentHandler")
// .field(&self.subcommands) .field(&self.subcommands)
.finish() .finish()
} }
} }