mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 19:31:02 +00:00
Phase 1 of repo reorg (#719)
* Remove unneeded script * Rename Substrate Demo -> Substrate * Rename demo -> node * Build wasm from last rename. * Merge ed25519 into substrate-primitives * Minor tweak * Rename substrate -> core * Move substrate-runtime-support to core/runtime/support * Rename/move substrate-runtime-version * Move codec up a level * Rename substrate-codec -> parity-codec * Move environmental up a level * Move pwasm-* up to top, ready for removal * Remove requirement of s-r-support from s-r-primitives * Move core/runtime/primitives into core/runtime-primitives * Remove s-r-support dep from s-r-version * Remove dep of s-r-support from bft * Remove dep of s-r-support from node/consensus * Sever all other core deps from s-r-support * Forgot the no_std directive * Rename non-SRML modules to sr-* to avoid match clashes * Move runtime/* to srml/* * Rename substrate-runtime-* -> srml-* * Move srml to top-level
This commit is contained in:
committed by
Arkadiy Paronyan
parent
8fe5aa4c81
commit
1e01162505
@@ -0,0 +1,23 @@
|
||||
[package]
|
||||
name = "pwasm-alloc"
|
||||
version = "0.1.0"
|
||||
authors = ["Nikolay Volf <nikvolf@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/paritytech/pwasm-std"
|
||||
homepage = "https://github.com/paritytech/pwasm-std"
|
||||
documentation = "https://paritytech.github.io/pwasm-std/pwasm_std/"
|
||||
description = "Parity WebAssembly standard library internal allocator"
|
||||
keywords = ["wasm", "parity", "webassembly", "blockchain"]
|
||||
categories = ["no-std", "embedded"]
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
pwasm-libc = { path = "../pwasm-libc", version = "0.1" }
|
||||
|
||||
[build-dependencies]
|
||||
rustc_version = "0.2"
|
||||
|
||||
[features]
|
||||
strict = []
|
||||
nightly = []
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
= Pwasm-alloc
|
||||
|
||||
Parity WASM contracts standard library libc bindings.
|
||||
|
||||
See https://paritytech.github.io/pwasm-std/pwasm_alloc/ for the documentation.
|
||||
|
||||
== License
|
||||
|
||||
`pwasm_alloc` is primarily distributed under the terms of both the MIT
|
||||
license and the Apache License (Version 2.0), at your choice.
|
||||
|
||||
See LICENSE-APACHE, and LICENSE-MIT for details.
|
||||
|
||||
.Summary
|
||||
[source, toml]
|
||||
----
|
||||
include::Cargo.toml[lines=2..5]
|
||||
----
|
||||
|
||||
.Description
|
||||
----
|
||||
include::src/lib.rs[tag=description]
|
||||
----
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//! Set a nightly feature
|
||||
|
||||
extern crate rustc_version;
|
||||
use rustc_version::{version, version_meta, Channel};
|
||||
|
||||
fn main() {
|
||||
// Assert we haven't travelled back in time
|
||||
assert!(version().unwrap().major >= 1);
|
||||
|
||||
// Set cfg flags depending on release channel
|
||||
if let Channel::Nightly = version_meta().unwrap().channel {
|
||||
println!("cargo:rustc-cfg=feature=\"nightly\"");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(feature = "strict", deny(warnings))]
|
||||
#![no_std]
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
// tag::description[]
|
||||
//! Custom allocator crate for wasm
|
||||
// end::description[]
|
||||
|
||||
/// Wasm allocator
|
||||
pub struct WasmAllocator;
|
||||
|
||||
#[cfg(feature = "nightly")]
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: WasmAllocator = WasmAllocator;
|
||||
|
||||
#[cfg(feature = "nightly")]
|
||||
mod __impl {
|
||||
extern crate pwasm_libc;
|
||||
|
||||
use core::alloc::{GlobalAlloc, Layout};
|
||||
|
||||
use super::WasmAllocator;
|
||||
|
||||
unsafe impl GlobalAlloc for WasmAllocator {
|
||||
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
||||
pwasm_libc::malloc(layout.size()) as *mut u8
|
||||
}
|
||||
|
||||
unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
|
||||
pwasm_libc::free(ptr as *mut u8)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user