From 15a8f528aeef31736c5d2e085ddf45e4a2ac3ef0 Mon Sep 17 00:00:00 2001 From: J Henry Waugh Date: Fri, 21 Aug 2020 22:29:04 -0500 Subject: [PATCH] Avoid export_fn+cfg attributes in Rhai packages --- src/packages/string_basic.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/packages/string_basic.rs b/src/packages/string_basic.rs index 020f9292..827ba183 100644 --- a/src/packages/string_basic.rs +++ b/src/packages/string_basic.rs @@ -88,9 +88,9 @@ def_package!(crate:BasicStringPackage:"Basic string utilities, including printin #[cfg(not(feature = "no_object"))] { - set_exported_fn!(lib, KEYWORD_PRINT, format_map); - set_exported_fn!(lib, FN_TO_STRING, format_map); - set_exported_fn!(lib, KEYWORD_DEBUG, format_map); + set_exported_fn!(lib, KEYWORD_PRINT, format_map::format_map); + set_exported_fn!(lib, FN_TO_STRING, format_map::format_map); + set_exported_fn!(lib, KEYWORD_DEBUG, format_map::format_map); } }); @@ -154,8 +154,11 @@ fn to_debug(x: &mut T) -> ImmutableString { format!("{:?}", x).into() } #[cfg(not(feature = "no_object"))] -#[export_fn] -#[inline] -fn format_map(x: &mut Map) -> ImmutableString { - format!("#{:?}", x).into() +mod format_map { + use super::*; + #[inline] + #[export_fn] + pub fn format_map(x: &mut Map) -> ImmutableString { + format!("#{:?}", x).into() + } }