mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Get rid of core::string in sr-std. (#783)
This commit is contained in:
committed by
Gav Wood
parent
25393abef8
commit
28cc4d0fd6
@@ -29,7 +29,6 @@ pub use std::ops;
|
||||
pub use std::ptr;
|
||||
pub use std::rc;
|
||||
pub use std::slice;
|
||||
pub use std::string;
|
||||
pub use std::vec;
|
||||
pub use std::result;
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ mod __impl {
|
||||
pub use alloc::boxed;
|
||||
pub use alloc::rc;
|
||||
pub use alloc::vec;
|
||||
pub use alloc::string;
|
||||
pub use core::borrow;
|
||||
pub use core::cell;
|
||||
pub use core::clone;
|
||||
@@ -63,6 +62,9 @@ pub use core::ops;
|
||||
pub use core::ptr;
|
||||
pub use core::slice;
|
||||
pub use core::result;
|
||||
// We are trying to avoid certain things here, such as `core::string`
|
||||
// (if you need `String` you most probably doing something wrong, since
|
||||
// runtime doesn't require anything human readable).
|
||||
|
||||
pub mod collections {
|
||||
pub use alloc::collections::btree_map;
|
||||
|
||||
@@ -280,6 +280,6 @@ mod tests {
|
||||
);
|
||||
|
||||
let env = init_env::<MockExt>();
|
||||
assert!(env.funcs.get("ext_gas").is_some());
|
||||
assert!(env.funcs.get(&b"ext_gas"[..]).is_some());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ use super::{SpecialTrap, BalanceOf, CreateReceipt, Ext, GasMeterResult, Runtime}
|
||||
use codec::{Encode, Decode};
|
||||
use parity_wasm::elements::{FunctionType, ValueType};
|
||||
use rstd::prelude::*;
|
||||
use rstd::string::String;
|
||||
use rstd::collections::btree_map::BTreeMap;
|
||||
use runtime_primitives::traits::{As, CheckedMul};
|
||||
use sandbox::{self, TypedValue};
|
||||
@@ -75,7 +74,7 @@ impl ConvertibleToWasm for u64 {
|
||||
/// which can be imported and called by the module.
|
||||
pub(crate) struct HostFunctionSet<E: Ext> {
|
||||
/// Functions which defined in the environment.
|
||||
pub funcs: BTreeMap<String, HostFunction<E>>,
|
||||
pub funcs: BTreeMap<Vec<u8>, HostFunction<E>>,
|
||||
}
|
||||
impl<E: Ext> HostFunctionSet<E> {
|
||||
pub fn new() -> Self {
|
||||
|
||||
@@ -138,7 +138,7 @@ impl<'a, T: Trait> ContractModule<'a, T> {
|
||||
|
||||
let ext_func = env
|
||||
.funcs
|
||||
.get(import.field())
|
||||
.get(import.field().as_bytes())
|
||||
.ok_or_else(|| Error::Instantiate)?;
|
||||
if !ext_func.func_type_matches(func_ty) {
|
||||
return Err(Error::Instantiate);
|
||||
|
||||
Reference in New Issue
Block a user