From 96aa5ed39e88bb5a79bdc1181212f3b8ca670bdc Mon Sep 17 00:00:00 2001 From: John-John Tedro Date: Fri, 24 Jul 2020 16:20:47 +0200 Subject: [PATCH] set_indexer_set_fn to support setting generic value --- src/module.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/module.rs b/src/module.rs index 7216c248..d4cec91e 100644 --- a/src/module.rs +++ b/src/module.rs @@ -738,18 +738,18 @@ impl Module { /// }); /// assert!(module.contains_fn(hash)); /// ``` - pub fn set_indexer_set_fn( + pub fn set_indexer_set_fn( &mut self, - func: impl Fn(&mut A, B, A) -> FuncReturn<()> + SendSync + 'static, + func: impl Fn(&mut A, B, C) -> FuncReturn<()> + SendSync + 'static, ) -> u64 { let f = move |_: &Engine, _: &Module, args: &mut FnCallArgs| { let b = mem::take(args[1]).cast::(); - let c = mem::take(args[2]).cast::(); + let c = mem::take(args[2]).cast::(); let a = args[0].downcast_mut::().unwrap(); func(a, b, c).map(Dynamic::from) }; - let arg_types = [TypeId::of::(), TypeId::of::(), TypeId::of::()]; + let arg_types = [TypeId::of::(), TypeId::of::(), TypeId::of::()]; self.set_fn( FN_IDX_SET, Public,