Commit d3b091d4 authored by Hero Bird's avatar Hero Bird Committed by GitHub

[prelude] add ink_prelude crate (#282)

This shall replace the ink_core::memory sub module in the future.
parent 63163f73
Pipeline #70469 passed with stages
in 12 minutes and 36 seconds
[workspace]
members = [
"utils",
"abi",
"core",
"model",
"lang",
"lang2",
"abi",
"model",
"prelude",
"utils",
]
exclude = [
"examples/",
......
[package]
name = "ink_prelude"
version = "0.1.0"
authors = ["Robin Freyler <robin@parity.io>", "Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "APACHE-2.0"
readme = "README.md"
repository = "https://github.com/paritytech/ink"
documentation = "https://substrate.dev/substrate-contracts-workshop/#/"
homepage = "https://www.parity.io/"
description = "[ink!] Rust based eDSL for writing smart contracts for Substrate"
keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"]
categories = ["no-std", "embedded"]
include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
[lib]
name = "ink_prelude"
path = "lib.rs"
[dependencies]
cfg-if = "0.1"
[features]
default = ["std"]
std = []
../LICENSE
\ No newline at end of file
../README.md
\ No newline at end of file
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Data structures to operate on contract memory during contract execution.
//!
//! These definitions are useful since we are operating in a `no_std` environment
//! and should be used by all ink! crates instead of directly using `std` or `alloc`
//! crates. If needed we shall instead enhance the exposed types here.
//!
//! The `ink_prelude` crate guarantees a stable interface between `std` and `no_std` mode.
#[cfg(not(feature = "std"))]
extern crate alloc;
use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "std")] {
pub use std::{
borrow,
boxed,
format,
string,
vec,
};
/// Collection types.
pub mod collections {
pub use self::{
binary_heap::BinaryHeap,
btree_map::BTreeMap,
btree_set::BTreeSet,
linked_list::LinkedList,
vec_deque::VecDeque,
Bound,
};
pub use std::collections::*;
}
} else {
pub use alloc::{
borrow,
boxed,
format,
string,
vec,
};
/// Collection types.
pub mod collections {
pub use self::{
BTreeMap,
BTreeSet,
BinaryHeap,
LinkedList,
VecDeque,
};
pub use alloc::collections::*;
pub use core::ops::Bound;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment