Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
fix up core build with alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Jun 6, 2024
1 parent f765a0d commit 1971c1e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/src/ctxt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ mod internal {
#[cfg(feature = "alloc")]
mod alloc_support {
use core::any::Any;
use alloc::boxed::Box;

use crate::props::ErasedProps;

Expand Down
5 changes: 4 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion core/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
2 changes: 1 addition & 1 deletion core/src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
2 changes: 2 additions & 0 deletions core/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion core/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down Expand Up @@ -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> {
/**
Expand Down

0 comments on commit 1971c1e

Please sign in to comment.