Fix docs.

This commit is contained in:
Stephen Chung 2020-08-11 13:46:09 +08:00
parent 2d4b85f67d
commit a5b4d61dff
2 changed files with 10 additions and 10 deletions

View File

@ -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::<A>().unwrap();
let this_ptr: &mut A = &mut *first[0].write_lock::<A>().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::<B>().unwrap();
let value_ref: &B = &*rest[0].read_lock::<B>().unwrap();
```

View File

@ -611,9 +611,9 @@ impl Module {
) -> u64 {
let f = move |_: &Engine, _: &Module, args: &mut FnCallArgs| {
let b = mem::take(args[1]).cast::<B>();
let mut a = args[0].write_lock::<A>().unwrap();
let a = &mut args[0].write_lock::<A>().unwrap();
func(&mut a, b).map(Dynamic::from)
func(a, b).map(Dynamic::from)
};
let arg_types = [TypeId::of::<A>(), TypeId::of::<B>()];
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::<B>();
let c = mem::take(args[2]).cast::<C>();
let mut a = args[0].write_lock::<A>().unwrap();
let a = &mut args[0].write_lock::<A>().unwrap();
func(&mut a, b, c).map(Dynamic::from)
func(a, b, c).map(Dynamic::from)
};
let arg_types = [TypeId::of::<A>(), TypeId::of::<B>(), TypeId::of::<C>()];
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::<B>();
let c = mem::take(args[2]).cast::<C>();
let mut a = args[0].write_lock::<A>().unwrap();
let a = &mut args[0].write_lock::<A>().unwrap();
func(&mut a, b, c).map(Dynamic::from)
func(a, b, c).map(Dynamic::from)
};
let arg_types = [TypeId::of::<A>(), TypeId::of::<B>(), TypeId::of::<C>()];
self.set_fn(
@ -892,9 +892,9 @@ impl Module {
let b = mem::take(args[1]).cast::<B>();
let c = mem::take(args[2]).cast::<C>();
let d = mem::take(args[3]).cast::<D>();
let mut a = args[0].write_lock::<A>().unwrap();
let a = &mut args[0].write_lock::<A>().unwrap();
func(&mut a, b, c, d).map(Dynamic::from)
func(a, b, c, d).map(Dynamic::from)
};
let arg_types = [
TypeId::of::<A>(),