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,14 +426,17 @@ 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" if name == type_name::<ImmutableString>() {
} else if name == type_name::<&str>() { return "string";
"string" }
} else if name == type_name::<FnPtr>() { if name == type_name::<&str>() {
"Fn" return "string";
} else { }
if name == type_name::<FnPtr>() {
return "Fn";
}
#[cfg(feature = "decimal")] #[cfg(feature = "decimal")]
if name == type_name::<Decimal>() { if name == type_name::<Decimal>() {
return "decimal"; return "decimal";
@ -453,7 +456,6 @@ pub(crate) fn map_std_type_name(name: &str) -> &str {
name name
} }
}
impl fmt::Display for Dynamic { impl fmt::Display for Dynamic {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@ -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();