Add Dynamic::clone_cast.

This commit is contained in:
Stephen Chung
2021-03-30 18:57:16 +08:00
parent ec7b906f71
commit b14d18934a
7 changed files with 70 additions and 33 deletions

View File

@@ -768,7 +768,7 @@ impl Module {
/// // Get the second parameter by 'consuming' it
/// let double = std::mem::take(args[1]).cast::<bool>();
/// // Since it is a primary type, it can also be cheaply copied
/// let double = args[1].clone().cast::<bool>();
/// let double = args[1].clone_cast::<bool>();
/// // Get a mutable reference to the first argument.
/// let mut x = args[0].write_lock::<i64>().unwrap();
///