From e13808674ad24717376ded64a35106a7481dfc4d Mon Sep 17 00:00:00 2001 From: Aiden McClelland Date: Wed, 3 Jan 2024 16:59:34 -0700 Subject: [PATCH] enforce trait bounds at call site --- rpc-toolkit/src/handler/from_fn.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/rpc-toolkit/src/handler/from_fn.rs b/rpc-toolkit/src/handler/from_fn.rs index e3bec14..e9cf099 100644 --- a/rpc-toolkit/src/handler/from_fn.rs +++ b/rpc-toolkit/src/handler/from_fn.rs @@ -56,7 +56,10 @@ where } } -pub fn from_fn(function: F) -> FromFn { +pub fn from_fn(function: F) -> FromFn +where + FromFn: HandlerTypes, +{ FromFn { function, _phantom: PhantomData, @@ -65,7 +68,10 @@ pub fn from_fn(function: F) -> FromFn { } } -pub fn from_fn_blocking(function: F) -> FromFn { +pub fn from_fn_blocking(function: F) -> FromFn +where + FromFn: HandlerTypes, +{ FromFn { function, _phantom: PhantomData, @@ -104,7 +110,10 @@ where } } -pub fn from_fn_async(function: F) -> FromFnAsync { +pub fn from_fn_async(function: F) -> FromFnAsync +where + FromFnAsync: HandlerTypes, +{ FromFnAsync { function, _phantom: PhantomData,