Update docs and tests.

This commit is contained in:
Stephen Chung
2020-08-04 18:39:24 +08:00
parent b0ab6e95f5
commit 9f302d4ef5
8 changed files with 51 additions and 47 deletions

View File

@@ -600,6 +600,7 @@ impl Dynamic {
/// # Panics
///
/// Panics under the `no_closure` feature.
#[inline(always)]
pub fn into_shared(self) -> Self {
#[cfg(not(feature = "no_closure"))]
return match self.0 {
@@ -833,7 +834,6 @@ impl Dynamic {
let data = cell.read().unwrap();
let type_id = (*data).type_id();
println!("Type = {}", (*data).type_name());
if type_id != TypeId::of::<T>() && TypeId::of::<Dynamic>() != TypeId::of::<T>() {
None

View File

@@ -2,7 +2,7 @@
#![allow(non_snake_case)]
use crate::any::{Dynamic, Variant, DynamicWriteLock};
use crate::any::{Dynamic, DynamicWriteLock, Variant};
use crate::engine::Engine;
use crate::fn_native::{CallableFunction, FnAny, FnCallArgs, SendSync};
use crate::module::Module;
@@ -11,12 +11,7 @@ use crate::r#unsafe::unsafe_cast_box;
use crate::result::EvalAltResult;
use crate::utils::ImmutableString;
use crate::stdlib::{
any::TypeId,
boxed::Box,
mem,
string::String,
};
use crate::stdlib::{any::TypeId, boxed::Box, mem, string::String};
/// Trait to register custom functions with the `Engine`.
pub trait RegisterFn<FN, ARGS, RET> {