diff --git a/core/src/ctxt.rs b/core/src/ctxt.rs index 77a94c8..de025d2 100644 --- a/core/src/ctxt.rs +++ b/core/src/ctxt.rs @@ -257,6 +257,7 @@ mod internal { #[cfg(feature = "alloc")] mod alloc_support { use core::any::Any; + use alloc::boxed::Box; use crate::props::ErasedProps; diff --git a/core/src/lib.rs b/core/src/lib.rs index a7faf7c..3ceed43 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -11,7 +11,10 @@ If you're looking to use `emit` in an application you can use this library direc */ #![deny(missing_docs)] -#![cfg_attr(not(any(test, feature = "std")), no_std)] +#![cfg_attr(not(test), no_std)] + +#[cfg(feature = "std")] +extern crate std; #[cfg(feature = "alloc")] extern crate alloc; diff --git a/core/src/path.rs b/core/src/path.rs index 99584fb..7e70db1 100644 --- a/core/src/path.rs +++ b/core/src/path.rs @@ -242,7 +242,7 @@ impl<'a> serde::Serialize for Path<'a> { #[cfg(feature = "alloc")] mod alloc_support { - use alloc::borrow::Cow; + use alloc::{boxed::Box, borrow::Cow}; use super::*; diff --git a/core/src/str.rs b/core/src/str.rs index b41976d..4f33217 100644 --- a/core/src/str.rs +++ b/core/src/str.rs @@ -339,7 +339,7 @@ impl<'k> serde::Serialize for Str<'k> { #[cfg(feature = "alloc")] mod alloc_support { - use alloc::borrow::Cow; + use alloc::{borrow::{Cow, ToOwned}, string::String}; use super::*; diff --git a/core/src/template.rs b/core/src/template.rs index 1345cc4..1822b6a 100644 --- a/core/src/template.rs +++ b/core/src/template.rs @@ -660,6 +660,8 @@ enum PartKind<'a> { mod alloc_support { use super::*; + use alloc::vec::Vec; + impl Template<'static> { /** Create a template from a set of owned parts. diff --git a/core/src/value.rs b/core/src/value.rs index a0c9af6..73c2f7c 100644 --- a/core/src/value.rs +++ b/core/src/value.rs @@ -168,6 +168,8 @@ impl<'v> Value<'v> { fn visit_any(&mut self, value: value_bag::ValueBag) -> Result<(), value_bag::Error> { #[cfg(feature = "alloc")] { + use alloc::string::ToString; + self.0 = value.to_string().parse().ok(); Ok(()) @@ -420,7 +422,7 @@ impl ToValue for (dyn std::error::Error + 'static) { mod alloc_support { use super::*; - use alloc::borrow::Cow; + use alloc::{borrow::Cow, vec::Vec}; impl<'v> Value<'v> { /**