Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/primitives-traits/src/constants/gas_units.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#[cfg(feature = "std")]
use std::time::Duration;
Comment thread
mattsse marked this conversation as resolved.
Outdated

#[cfg(not(feature = "std"))]
use core::time::Duration;
#[cfg(not(feature = "std"))]
use alloc::string::String;

/// Represents one Kilogas, or `1_000` gas.
pub const KILOGAS: u64 = 1_000;

Expand Down
2 changes: 2 additions & 0 deletions crates/primitives-traits/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use core::{

#[cfg(not(feature = "std"))]
use alloc::boxed::Box;
#[cfg(not(feature = "std"))]
extern crate alloc;

/// A pair of values, one of which is expected and one of which is actual.
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
Expand Down
6 changes: 5 additions & 1 deletion crates/primitives-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]
// #![cfg_attr(not(feature = "std"), no_std)]
Comment thread
mattsse marked this conversation as resolved.
Outdated

#[cfg(feature = "alloy-compat")]
mod alloy_compat;

#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;

/// Common constants.
pub mod constants;
pub use constants::gas_units::{format_gas, format_gas_throughput};
Expand Down