Require either std or no_std to be specified

This commit is contained in:
grovesNL 2023-08-09 11:40:51 -02:30
parent 14d0ceb81b
commit c4d107563a
2 changed files with 6 additions and 4 deletions

View file

@ -7,10 +7,10 @@ use core::ops::{Deref, DerefMut};
type BuildHasher = core::hash::BuildHasherDefault<rustc_hash::FxHasher>;
#[cfg(feature = "no_std")]
type HashMap<K, V> = hashbrown::HashMap<K, V, BuildHasher>;
#[cfg(not(feature = "no_std"))]
#[cfg(feature = "std")]
type HashMap<K, V> = std::collections::HashMap<K, V, BuildHasher>;
#[cfg(not(feature = "std"))]
type HashMap<K, V> = hashbrown::HashMap<K, V, BuildHasher>;
// re-export fontdb and rustybuzz
pub use fontdb;

View file

@ -91,9 +91,11 @@
// Ensure numbers are readable
#![warn(clippy::unreadable_literal)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
#[cfg(not(any(feature = "std", feature = "no_std")))]
compile_error!("Either the `std` or `no_std` feature must be enabled");
pub use self::attrs::*;
mod attrs;