Rename: primitives/sr-std -> primitives/sp-std (#4327)

* primitives/sr-std -> primitives/std

* fix

* fix conflict

* rstd -> sp-std

* git mv

* fix review

* fix merge
This commit is contained in:
Weiliang Li
2019-12-10 16:26:27 +09:00
committed by Gavin Wood
parent 448dbc89a5
commit 6da9f59d72
210 changed files with 552 additions and 556 deletions
@@ -22,7 +22,7 @@ use std::fmt;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use rstd::prelude::*;
use sp_std::prelude::*;
use primitives::RuntimeDebug;
use crate::codec::{Codec, Encode, Decode};
use crate::traits::{self, Member, Block as BlockT, Header as HeaderT, MaybeSerialize};
@@ -19,7 +19,7 @@
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use rstd::prelude::*;
use sp_std::prelude::*;
use crate::ConsensusEngineId;
use crate::codec::{Decode, Encode, Input, Error};
@@ -25,7 +25,7 @@ use crate::traits::{
};
use crate::generic::Digest;
use primitives::U256;
use rstd::{
use sp_std::{
convert::TryFrom,
fmt::Debug,
};
@@ -104,10 +104,10 @@ impl<Number, Hash> codec::EncodeLike for Header<Number, Hash> where
{}
impl<Number, Hash> traits::Header for Header<Number, Hash> where
Number: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash + MaybeDisplay +
Number: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + MaybeDisplay +
SimpleArithmetic + Codec + Copy + Into<U256> + TryFrom<U256>,
Hash: HashT,
Hash::Output: Default + rstd::hash::Hash + Copy + Member +
Hash::Output: Default + sp_std::hash::Hash + Copy + Member +
MaybeSerialize + Debug + MaybeDisplay + SimpleBitOps + Codec,
{
type Number = Number;
@@ -152,9 +152,9 @@ impl<Number, Hash> traits::Header for Header<Number, Hash> where
}
impl<Number, Hash> Header<Number, Hash> where
Number: Member + rstd::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec + Into<U256> + TryFrom<U256>,
Number: Member + sp_std::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec + Into<U256> + TryFrom<U256>,
Hash: HashT,
Hash::Output: Default + rstd::hash::Hash + Copy + Member + MaybeDisplay + SimpleBitOps + Codec,
Hash::Output: Default + sp_std::hash::Hash + Copy + Member + MaybeDisplay + SimpleBitOps + Codec,
{
/// Convenience helper for computing the hash of the header without having
/// to import the trait.
@@ -37,10 +37,10 @@ pub use self::digest::{
};
use crate::codec::Encode;
use rstd::prelude::*;
use sp_std::prelude::*;
fn encode_with_vec_prefix<T: Encode, F: Fn(&mut Vec<u8>)>(encoder: F) -> Vec<u8> {
let size = ::rstd::mem::size_of::<T>();
let size = ::sp_std::mem::size_of::<T>();
let reserve = match size {
0..=0b00111111 => 1,
0..=0b00111111_11111111 => 2,
@@ -16,7 +16,7 @@
//! Generic implementation of an unchecked (pre-verification) extrinsic.
use rstd::{fmt, prelude::*};
use sp_std::{fmt, prelude::*};
use runtime_io::hashing::blake2_256;
use codec::{Decode, Encode, EncodeLike, Input, Error};
use crate::{
@@ -322,7 +322,7 @@ mod tests {
type DispatchInfo = ();
type Pre = ();
fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) }
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
}
type Ex = UncheckedExtrinsic<TestAccountId, TestCall, TestSig, TestExtra>;
+6 -6
View File
@@ -29,7 +29,7 @@ pub use codec;
#[doc(hidden)]
pub use serde;
#[doc(hidden)]
pub use rstd;
pub use sp_std;
#[doc(hidden)]
pub use paste;
@@ -40,8 +40,8 @@ pub use app_crypto;
#[cfg(feature = "std")]
pub use primitives::storage::{StorageOverlay, ChildrenStorageOverlay};
use rstd::prelude::*;
use rstd::convert::TryFrom;
use sp_std::prelude::*;
use sp_std::convert::TryFrom;
use primitives::{crypto, ed25519, sr25519, ecdsa, hash::{H256, H512}};
use codec::{Encode, Decode};
@@ -613,14 +613,14 @@ macro_rules! assert_eq_error_rate {
#[derive(PartialEq, Eq, Clone, Default, Encode, Decode)]
pub struct OpaqueExtrinsic(pub Vec<u8>);
impl rstd::fmt::Debug for OpaqueExtrinsic {
impl sp_std::fmt::Debug for OpaqueExtrinsic {
#[cfg(feature = "std")]
fn fmt(&self, fmt: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
write!(fmt, "{}", primitives::hexdisplay::HexDisplay::from(&self.0))
}
#[cfg(not(feature = "std"))]
fn fmt(&self, _fmt: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, _fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
Ok(())
}
}
@@ -47,10 +47,10 @@
//! assert_eq!(body.error(), &None);
//! ```
use rstd::str;
use rstd::prelude::Vec;
use sp_std::str;
use sp_std::prelude::Vec;
#[cfg(not(feature = "std"))]
use rstd::prelude::vec;
use sp_std::prelude::vec;
use primitives::RuntimeDebug;
use primitives::offchain::{
Timestamp,
@@ -111,7 +111,7 @@ mod header {
/// Returns the name of this header.
pub fn name(&self) -> &str {
// Header keys are always produced from `&str` so this is safe.
// we don't store them as `Strings` to avoid bringing `alloc::String` to rstd
// we don't store them as `Strings` to avoid bringing `alloc::String` to sp-std
// or here.
unsafe { str::from_utf8_unchecked(&self.name) }
}
@@ -119,7 +119,7 @@ mod header {
/// Returns the value of this header.
pub fn value(&self) -> &str {
// Header values are always produced from `&str` so this is safe.
// we don't store them as `Strings` to avoid bringing `alloc::String` to rstd
// we don't store them as `Strings` to avoid bringing `alloc::String` to sp-std
// or here.
unsafe { str::from_utf8_unchecked(&self.value) }
}
+18 -18
View File
@@ -16,8 +16,8 @@
//! Primitives for the runtime modules.
use rstd::prelude::*;
use rstd::{self, result, marker::PhantomData, convert::{TryFrom, TryInto}, fmt::Debug};
use sp_std::prelude::*;
use sp_std::{self, result, marker::PhantomData, convert::{TryFrom, TryInto}, fmt::Debug};
use runtime_io;
#[cfg(feature = "std")]
use std::fmt::Display;
@@ -316,15 +316,15 @@ impl<T: Default + Eq + PartialEq> Clear for T {
/// A meta trait for all bit ops.
pub trait SimpleBitOps:
Sized + Clear +
rstd::ops::BitOr<Self, Output = Self> +
rstd::ops::BitXor<Self, Output = Self> +
rstd::ops::BitAnd<Self, Output = Self>
sp_std::ops::BitOr<Self, Output = Self> +
sp_std::ops::BitXor<Self, Output = Self> +
sp_std::ops::BitAnd<Self, Output = Self>
{}
impl<T:
Sized + Clear +
rstd::ops::BitOr<Self, Output = Self> +
rstd::ops::BitXor<Self, Output = Self> +
rstd::ops::BitAnd<Self, Output = Self>
sp_std::ops::BitOr<Self, Output = Self> +
sp_std::ops::BitXor<Self, Output = Self> +
sp_std::ops::BitAnd<Self, Output = Self>
> SimpleBitOps for T {}
/// The block finalization trait. Implementing this lets you express what should happen
@@ -369,7 +369,7 @@ pub trait OffchainWorker<BlockNumber> {
// traits must be fulfilled by all type parameters.
pub trait Hash: 'static + MaybeSerializeDeserialize + Debug + Clone + Eq + PartialEq {
/// The hash type produced.
type Output: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash
type Output: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash
+ AsRef<[u8]> + AsMut<[u8]> + Copy + Default + Encode + Decode;
/// The associated hash_db Hasher type.
@@ -481,7 +481,7 @@ impl_maybe_marker!(
MaybeDisplay: Display;
/// A type that implements Hash when in std environment.
MaybeHash: rstd::hash::Hash;
MaybeHash: sp_std::hash::Hash;
/// A type that implements Serialize when in std environment.
MaybeSerialize: Serialize;
@@ -523,10 +523,10 @@ pub trait IsMember<MemberId> {
/// You can also create a `new` one from those fields.
pub trait Header: Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + 'static {
/// Header number.
type Number: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash
type Number: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash
+ Copy + MaybeDisplay + SimpleArithmetic + Codec;
/// Header hash type
type Hash: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash
type Hash: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash
+ Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
/// Hashing algorithm
type Hashing: Hash<Output = Self::Hash>;
@@ -581,7 +581,7 @@ pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + 'st
/// Header type.
type Header: Header<Hash=Self::Hash>;
/// Block hash type.
type Hash: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash
type Hash: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash
+ Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
/// Returns a reference to the header.
@@ -865,7 +865,7 @@ impl SignedExtension for () {
type Call = ();
type Pre = ();
type DispatchInfo = ();
fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) }
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
}
/// An "executable" piece of information, used by the standard Substrate Executive in order to
@@ -906,7 +906,7 @@ pub trait Applyable: Sized + Send + Sync {
}
/// Auxiliary wrapper that holds an api instance and binds it to the given lifetime.
pub struct ApiRef<'a, T>(T, rstd::marker::PhantomData<&'a ()>);
pub struct ApiRef<'a, T>(T, sp_std::marker::PhantomData<&'a ()>);
impl<'a, T> From<T> for ApiRef<'a, T> {
fn from(api: T) -> Self {
@@ -914,7 +914,7 @@ impl<'a, T> From<T> for ApiRef<'a, T> {
}
}
impl<'a, T> rstd::ops::Deref for ApiRef<'a, T> {
impl<'a, T> sp_std::ops::Deref for ApiRef<'a, T> {
type Target = T;
fn deref(&self) -> &Self::Target {
@@ -922,7 +922,7 @@ impl<'a, T> rstd::ops::Deref for ApiRef<'a, T> {
}
}
impl<'a, T> rstd::ops::DerefMut for ApiRef<'a, T> {
impl<'a, T> sp_std::ops::DerefMut for ApiRef<'a, T> {
fn deref_mut(&mut self) -> &mut T {
&mut self.0
}
@@ -1161,7 +1161,7 @@ macro_rules! impl_opaque_keys {
/// The generated key pairs are stored in the keystore.
///
/// Returns the concatenated SCALE encoded public keys.
pub fn generate(seed: Option<$crate::rstd::vec::Vec<u8>>) -> $crate::rstd::vec::Vec<u8> {
pub fn generate(seed: Option<$crate::sp_std::vec::Vec<u8>>) -> $crate::sp_std::vec::Vec<u8> {
let keys = Self{
$(
$field: <
@@ -16,7 +16,7 @@
//! Transaction validity interface.
use rstd::prelude::*;
use sp_std::prelude::*;
use crate::codec::{Encode, Decode};
use crate::RuntimeDebug;