Fix sync build.

This commit is contained in:
Stephen Chung 2021-03-26 16:57:28 +08:00
parent c443c3bb48
commit 33f88dc813
2 changed files with 31 additions and 29 deletions

View File

@ -426,33 +426,35 @@ impl Hash for Dynamic {
#[inline(always)] #[inline(always)]
pub(crate) fn map_std_type_name(name: &str) -> &str { pub(crate) fn map_std_type_name(name: &str) -> &str {
if name == type_name::<String>() { if name == type_name::<String>() {
"string" return "string";
} else if name == type_name::<ImmutableString>() {
"string"
} else if name == type_name::<&str>() {
"string"
} else if name == type_name::<FnPtr>() {
"Fn"
} else {
#[cfg(feature = "decimal")]
if name == type_name::<Decimal>() {
return "decimal";
}
#[cfg(not(feature = "no_index"))]
if name == type_name::<Array>() {
return "array";
}
#[cfg(not(feature = "no_object"))]
if name == type_name::<Map>() {
return "map";
}
#[cfg(not(feature = "no_std"))]
if name == type_name::<Instant>() {
return "timestamp";
}
name
} }
if name == type_name::<ImmutableString>() {
return "string";
}
if name == type_name::<&str>() {
return "string";
}
if name == type_name::<FnPtr>() {
return "Fn";
}
#[cfg(feature = "decimal")]
if name == type_name::<Decimal>() {
return "decimal";
}
#[cfg(not(feature = "no_index"))]
if name == type_name::<Array>() {
return "array";
}
#[cfg(not(feature = "no_object"))]
if name == type_name::<Map>() {
return "map";
}
#[cfg(not(feature = "no_std"))]
if name == type_name::<Instant>() {
return "timestamp";
}
name
} }
impl fmt::Display for Dynamic { impl fmt::Display for Dynamic {
@ -905,7 +907,7 @@ impl Dynamic {
value = match unsafe_try_cast::<_, Map>(value) { value = match unsafe_try_cast::<_, Map>(value) {
Ok(map) => return (map).into(), Ok(map) => return (map).into(),
Err(val) => val, Err(val) => val,
} };
} }
value = match unsafe_try_cast::<_, FnPtr>(value) { value = match unsafe_try_cast::<_, FnPtr>(value) {
@ -918,7 +920,7 @@ impl Dynamic {
value = match unsafe_try_cast::<_, Instant>(value) { value = match unsafe_try_cast::<_, Instant>(value) {
Ok(timestamp) => return (timestamp).into(), Ok(timestamp) => return (timestamp).into(),
Err(val) => val, Err(val) => val,
} };
} }
Self(Union::Variant( Self(Union::Variant(

View File

@ -733,7 +733,7 @@ impl Module {
access: FnAccess, access: FnAccess,
_arg_names: Option<&[&str]>, _arg_names: Option<&[&str]>,
arg_types: &[TypeId], arg_types: &[TypeId],
func: impl PluginFunction + 'static, func: impl PluginFunction + SendSync + 'static,
) -> u64 { ) -> u64 {
let is_method = func.is_method_call(); let is_method = func.is_method_call();