fix custom_display_fn

This commit is contained in:
Aiden McClelland
2024-05-03 22:43:48 -06:00
parent 6bb66a4400
commit cbbeea0495
2 changed files with 5 additions and 7 deletions

View File

@@ -30,9 +30,9 @@ pub trait HandlerExt<Context: crate::Context>: HandlerFor<Context> + Sized {
fn with_custom_display_fn<C: crate::Context, F>( fn with_custom_display_fn<C: crate::Context, F>(
self, self,
display: F, display: F,
) -> CustomDisplayFn<F, Self, Context> ) -> CustomDisplayFn<F, Self, C>
where where
F: Fn(HandlerArgsFor<Context, Self>, Self::Ok) -> Result<(), Self::Err>; F: Fn(HandlerArgsFor<C, Self>, Self::Ok) -> Result<(), Self::Err>;
fn with_inherited<Params, InheritedParams, F>( fn with_inherited<Params, InheritedParams, F>(
self, self,
f: F, f: F,
@@ -64,12 +64,9 @@ impl<Context: crate::Context, T: HandlerFor<Context> + Sized> HandlerExt<Context
handler: self, handler: self,
} }
} }
fn with_custom_display_fn<C: crate::Context, F>( fn with_custom_display_fn<C: crate::Context, F>(self, display: F) -> CustomDisplayFn<F, Self, C>
self,
display: F,
) -> CustomDisplayFn<F, Self, Context>
where where
F: Fn(HandlerArgsFor<Context, Self>, Self::Ok) -> Result<(), Self::Err>, F: Fn(HandlerArgsFor<C, Self>, Self::Ok) -> Result<(), Self::Err>,
{ {
CustomDisplayFn { CustomDisplayFn {
_phantom: PhantomData::new(), _phantom: PhantomData::new(),

View File

@@ -129,6 +129,7 @@ fn make_api<C: Context>() -> ParentHandler<C> {
)) ))
}, },
) )
.with_custom_display_fn(|_, a| Ok(println!("{a}")))
.with_call_remote::<CliContext>(), .with_call_remote::<CliContext>(),
) )
.subcommand( .subcommand(