mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 11:38:01 +00:00
20a3989785
* Implement Printable for tuples. * Add debugging function. * Add debug 1. * Implement for everything. * RuntimeDebug derive. * Introduce RuntimeDebug. * Add some dummy logging. * Replace RuntimeDebug with Debug. * Revert "Replace RuntimeDebug with Debug." This reverts commit bc47070a8cb30241b2b590b2fa29fd195088162f. * Working on Debug for all. * Fix bounds. * Add debug utils. * Implement runtime logging. * Add some docs and clean up. * Clean up derives. * Fix custom derive impl. * Bump runtime. * Fix long lines. * Fix doc test. * Use CARGO_CFG_STD. * Revert "Use CARGO_CFG_STD." This reverts commit ea429566de18ed0fa052571b359eb9826a64a9f4. * Use parse_macro_input * Update lockfile. * Apply review suggestions. * Remove stray re-export. * Add no-std impl. * Update lockfile.
83 lines
2.2 KiB
Rust
Executable File
83 lines
2.2 KiB
Rust
Executable File
// Copyright 2017-2019 Parity Technologies (UK) Ltd.
|
|
// This file is part of Substrate.
|
|
|
|
// Substrate is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Substrate is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#[doc(hidden)]
|
|
pub extern crate alloc;
|
|
|
|
extern "C" {
|
|
fn ext_malloc(size: u32) -> *mut u8;
|
|
fn ext_free(ptr: *mut u8);
|
|
}
|
|
|
|
/// Wasm allocator
|
|
pub struct WasmAllocator;
|
|
|
|
#[cfg(not(feature = "no_global_allocator"))]
|
|
#[global_allocator]
|
|
static ALLOCATOR: WasmAllocator = WasmAllocator;
|
|
|
|
mod __impl {
|
|
use core::alloc::{GlobalAlloc, Layout};
|
|
|
|
use super::WasmAllocator;
|
|
|
|
unsafe impl GlobalAlloc for WasmAllocator {
|
|
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
|
super::ext_malloc(layout.size() as u32) as *mut u8
|
|
}
|
|
|
|
unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
|
|
super::ext_free(ptr as *mut u8)
|
|
}
|
|
}
|
|
}
|
|
|
|
pub use alloc::boxed;
|
|
pub use alloc::rc;
|
|
pub use alloc::vec;
|
|
pub use core::cell;
|
|
pub use core::clone;
|
|
pub use core::cmp;
|
|
pub use core::convert;
|
|
pub use core::default;
|
|
pub use core::fmt;
|
|
pub use core::hash;
|
|
pub use core::intrinsics;
|
|
pub use core::iter;
|
|
pub use core::marker;
|
|
pub use core::mem;
|
|
pub use core::num;
|
|
pub use core::ops;
|
|
pub use core::ptr;
|
|
pub use core::result;
|
|
pub use core::slice;
|
|
// Allow intepreting vectors of bytes as strings, but not constructing them.
|
|
pub use core::str;
|
|
// We are trying to avoid certain things here, such as `core::string`
|
|
// (if you need `String` you are probably doing something wrong, since
|
|
// runtime doesn't require anything human readable).
|
|
|
|
pub mod collections {
|
|
pub use alloc::collections::btree_map;
|
|
pub use alloc::collections::btree_set;
|
|
pub use alloc::collections::vec_deque;
|
|
}
|
|
|
|
pub mod borrow {
|
|
pub use core::borrow::*;
|
|
pub use alloc::borrow::*;
|
|
}
|