mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Move "wasm" allocator into its own crate (#4716)
This moves the wasm-allocator (`FreeingBumpHeapAllocator`) into its own crate `sp-allocator`. This new crate can theoretically provide multiple different allocators. Besides moving the allocator, this pr also makes `FreeingBumpHeapAllocator` compile on `no_std`.
This commit is contained in:
committed by
Sergei Pepyakin
parent
670ce71009
commit
5bd6e94e64
@@ -458,36 +458,18 @@ impl<H: PartialEq + Eq + Debug> CheckEqual for super::generic::DigestItem<H> whe
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_maybe_marker {
|
||||
( $( $(#[$doc:meta])+ $trait_name:ident: $($trait_bound:path),+ );+ ) => {
|
||||
$(
|
||||
$(#[$doc])+
|
||||
#[cfg(feature = "std")]
|
||||
pub trait $trait_name: $($trait_bound +)+ {}
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: $($trait_bound +)+> $trait_name for T {}
|
||||
|
||||
$(#[$doc])+
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub trait $trait_name {}
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl<T> $trait_name for T {}
|
||||
)+
|
||||
}
|
||||
}
|
||||
|
||||
impl_maybe_marker!(
|
||||
sp_core::impl_maybe_marker!(
|
||||
/// A type that implements Display when in std environment.
|
||||
MaybeDisplay: Display;
|
||||
trait MaybeDisplay: Display;
|
||||
|
||||
/// A type that implements Hash when in std environment.
|
||||
MaybeHash: sp_std::hash::Hash;
|
||||
trait MaybeHash: sp_std::hash::Hash;
|
||||
|
||||
/// A type that implements Serialize when in std environment.
|
||||
MaybeSerialize: Serialize;
|
||||
trait MaybeSerialize: Serialize;
|
||||
|
||||
/// A type that implements Serialize, DeserializeOwned and Debug when in std environment.
|
||||
MaybeSerializeDeserialize: DeserializeOwned, Serialize
|
||||
trait MaybeSerializeDeserialize: DeserializeOwned, Serialize;
|
||||
);
|
||||
|
||||
/// A type that provides a randomness beacon.
|
||||
|
||||
Reference in New Issue
Block a user