From a5b4d61dff68e1a26fcccec2517ba66fd386dfcc Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 11 Aug 2020 13:46:09 +0800 Subject: [PATCH] Fix docs. --- doc/src/rust/register-raw.md | 4 ++-- src/module.rs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/src/rust/register-raw.md b/doc/src/rust/register-raw.md index b7069ce3..5a73cae7 100644 --- a/doc/src/rust/register-raw.md +++ b/doc/src/rust/register-raw.md @@ -171,9 +171,9 @@ to partition the slice: let (first, rest) = args.split_at_mut(1); // Mutable reference to the first parameter -let this_ptr: &mut Dynamic = &mut *first[0].write_lock::().unwrap(); +let this_ptr: &mut A = &mut *first[0].write_lock::().unwrap(); // Immutable reference to the second value parameter // This can be mutable but there is no point because the parameter is passed by value -let value_ref: &Dynamic = &*rest[0].read_lock::().unwrap(); +let value_ref: &B = &*rest[0].read_lock::().unwrap(); ``` diff --git a/src/module.rs b/src/module.rs index b3bd5598..dbb416a2 100644 --- a/src/module.rs +++ b/src/module.rs @@ -611,9 +611,9 @@ impl Module { ) -> u64 { let f = move |_: &Engine, _: &Module, args: &mut FnCallArgs| { let b = mem::take(args[1]).cast::(); - let mut a = args[0].write_lock::().unwrap(); + let a = &mut args[0].write_lock::().unwrap(); - func(&mut a, b).map(Dynamic::from) + func(a, b).map(Dynamic::from) }; let arg_types = [TypeId::of::(), TypeId::of::()]; self.set_fn(name, Public, &arg_types, Func::from_method(Box::new(f))) @@ -735,9 +735,9 @@ impl Module { let f = move |_: &Engine, _: &Module, args: &mut FnCallArgs| { let b = mem::take(args[1]).cast::(); let c = mem::take(args[2]).cast::(); - let mut a = args[0].write_lock::().unwrap(); + let a = &mut args[0].write_lock::().unwrap(); - func(&mut a, b, c).map(Dynamic::from) + func(a, b, c).map(Dynamic::from) }; let arg_types = [TypeId::of::(), TypeId::of::(), TypeId::of::()]; self.set_fn(name, Public, &arg_types, Func::from_method(Box::new(f))) @@ -769,9 +769,9 @@ impl Module { let f = move |_: &Engine, _: &Module, args: &mut FnCallArgs| { let b = mem::take(args[1]).cast::(); let c = mem::take(args[2]).cast::(); - let mut a = args[0].write_lock::().unwrap(); + let a = &mut args[0].write_lock::().unwrap(); - func(&mut a, b, c).map(Dynamic::from) + func(a, b, c).map(Dynamic::from) }; let arg_types = [TypeId::of::(), TypeId::of::(), TypeId::of::()]; self.set_fn( @@ -892,9 +892,9 @@ impl Module { let b = mem::take(args[1]).cast::(); let c = mem::take(args[2]).cast::(); let d = mem::take(args[3]).cast::(); - let mut a = args[0].write_lock::().unwrap(); + let a = &mut args[0].write_lock::().unwrap(); - func(&mut a, b, c, d).map(Dynamic::from) + func(a, b, c, d).map(Dynamic::from) }; let arg_types = [ TypeId::of::(),