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
@@ -57,8 +57,8 @@ impl ChangesTrieConfiguration {
) -> bool
where
Number: From<u32> + PartialEq +
::rstd::ops::Rem<Output=Number> + ::rstd::ops::Sub<Output=Number> +
::rstd::cmp::PartialOrd + Zero,
::sp_std::ops::Rem<Output=Number> + ::sp_std::ops::Sub<Output=Number> +
::sp_std::cmp::PartialOrd + Zero,
{
block > zero
&& self.is_digest_build_enabled()
@@ -92,8 +92,8 @@ impl ChangesTrieConfiguration {
) -> Option<Number>
where
Number: Clone + From<u32> + PartialOrd + PartialEq +
::rstd::ops::Add<Output=Number> + ::rstd::ops::Sub<Output=Number> +
::rstd::ops::Div<Output=Number> + ::rstd::ops::Mul<Output=Number> + Zero,
::sp_std::ops::Add<Output=Number> + ::sp_std::ops::Sub<Output=Number> +
::sp_std::ops::Div<Output=Number> + ::sp_std::ops::Mul<Output=Number> + Zero,
{
if block <= zero {
return None;
@@ -126,8 +126,8 @@ impl ChangesTrieConfiguration {
) -> Option<(Number, Number)>
where
Number: Clone + From<u32> + PartialOrd + PartialEq +
::rstd::ops::Add<Output=Number> + ::rstd::ops::Sub<Output=Number> +
::rstd::ops::Div<Output=Number> + ::rstd::ops::Mul<Output=Number>,
::sp_std::ops::Add<Output=Number> + ::sp_std::ops::Sub<Output=Number> +
::sp_std::ops::Div<Output=Number> + ::sp_std::ops::Mul<Output=Number>,
{
if !self.is_digest_build_enabled() {
return None;
@@ -160,8 +160,8 @@ impl ChangesTrieConfiguration {
pub fn digest_level_at_block<Number>(&self, zero: Number, block: Number) -> Option<(u32, u32, u32)>
where
Number: Clone + From<u32> + PartialEq +
::rstd::ops::Rem<Output=Number> + ::rstd::ops::Sub<Output=Number> +
::rstd::cmp::PartialOrd + Zero,
::sp_std::ops::Rem<Output=Number> + ::sp_std::ops::Sub<Output=Number> +
::sp_std::cmp::PartialOrd + Zero,
{
if !self.is_digest_build_required_at_block(zero.clone(), block.clone()) {
return None;
+12 -12
View File
@@ -18,10 +18,10 @@
//! Cryptographic utilities.
// end::description[]
use rstd::{vec::Vec, hash::Hash};
use sp_std::{vec::Vec, hash::Hash};
#[cfg(feature = "std")]
use rstd::convert::TryInto;
use rstd::convert::TryFrom;
use sp_std::convert::TryInto;
use sp_std::convert::TryFrom;
#[cfg(feature = "std")]
use parking_lot::Mutex;
#[cfg(feature = "std")]
@@ -34,7 +34,7 @@ use base58::{FromBase58, ToBase58};
use zeroize::Zeroize;
#[doc(hidden)]
pub use rstd::ops::Deref;
pub use sp_std::ops::Deref;
use runtime_interface::pass_by::PassByInner;
/// The root phrase for our publicly known keys.
@@ -86,7 +86,7 @@ impl<T: Zeroize> AsRef<T> for Protected<T> {
}
}
impl<T: Zeroize> rstd::ops::Deref for Protected<T> {
impl<T: Zeroize> sp_std::ops::Deref for Protected<T> {
type Target = T;
fn deref(&self) -> &T {
@@ -552,7 +552,7 @@ impl From<[u8; 32]> for AccountId32 {
}
}
impl<'a> rstd::convert::TryFrom<&'a [u8]> for AccountId32 {
impl<'a> sp_std::convert::TryFrom<&'a [u8]> for AccountId32 {
type Error = ();
fn try_from(x: &'a [u8]) -> Result<AccountId32, ()> {
if x.len() == 32 {
@@ -578,15 +578,15 @@ impl std::fmt::Display for AccountId32 {
}
}
impl rstd::fmt::Debug for AccountId32 {
impl sp_std::fmt::Debug for AccountId32 {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
let s = self.to_ss58check();
write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8])
}
#[cfg(not(feature = "std"))]
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
Ok(())
}
}
@@ -625,7 +625,7 @@ mod dummy {
fn as_mut(&mut self) -> &mut[u8] {
unsafe {
#[allow(mutable_transmutes)]
rstd::mem::transmute::<_, &'static mut [u8]>(&b""[..])
sp_std::mem::transmute::<_, &'static mut [u8]>(&b""[..])
}
}
}
@@ -772,8 +772,8 @@ pub trait Pair: CryptoType + Sized + Clone + Send + Sync + 'static {
///
/// `None` is returned if no matches are found.
#[cfg(feature = "std")]
fn from_string_with_seed(s: &str, password_override: Option<&str>)
-> Result<(Self, Option<Self::Seed>), SecretStringError>
fn from_string_with_seed(s: &str, password_override: Option<&str>)
-> Result<(Self, Option<Self::Seed>), SecretStringError>
{
let re = Regex::new(r"^(?P<phrase>[\d\w ]+)?(?P<path>(//?[^/]+)*)(///(?P<password>.*))?$")
.expect("constructed from known-good static value; qed");
+9 -9
View File
@@ -19,9 +19,9 @@
// end::description[]
#[cfg(feature = "full_crypto")]
use rstd::vec::Vec;
use sp_std::vec::Vec;
use rstd::cmp::Ordering;
use sp_std::cmp::Ordering;
use codec::{Encode, Decode};
#[cfg(feature = "full_crypto")]
@@ -102,7 +102,7 @@ impl AsMut<[u8]> for Public {
}
}
impl rstd::convert::TryFrom<&[u8]> for Public {
impl sp_std::convert::TryFrom<&[u8]> for Public {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -166,8 +166,8 @@ impl<'de> Deserialize<'de> for Public {
}
#[cfg(feature = "full_crypto")]
impl rstd::hash::Hash for Public {
fn hash<H: rstd::hash::Hasher>(&self, state: &mut H) {
impl sp_std::hash::Hash for Public {
fn hash<H: sp_std::hash::Hasher>(&self, state: &mut H) {
self.0.hash(state);
}
}
@@ -176,7 +176,7 @@ impl rstd::hash::Hash for Public {
#[derive(Encode, Decode)]
pub struct Signature([u8; 65]);
impl rstd::convert::TryFrom<&[u8]> for Signature {
impl sp_std::convert::TryFrom<&[u8]> for Signature {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -261,9 +261,9 @@ impl std::fmt::Debug for Signature {
}
#[cfg(feature = "full_crypto")]
impl rstd::hash::Hash for Signature {
fn hash<H: rstd::hash::Hasher>(&self, state: &mut H) {
rstd::hash::Hash::hash(&self.0[..], state);
impl sp_std::hash::Hash for Signature {
fn hash<H: sp_std::hash::Hasher>(&self, state: &mut H) {
sp_std::hash::Hash::hash(&self.0[..], state);
}
}
+13 -13
View File
@@ -19,7 +19,7 @@
// end::description[]
#[cfg(feature = "full_crypto")]
use rstd::vec::Vec;
use sp_std::vec::Vec;
use crate::{hash::H256, hash::H512};
use codec::{Encode, Decode};
@@ -40,7 +40,7 @@ use crate::crypto::Ss58Codec;
use serde::{de, Serializer, Serialize, Deserializer, Deserialize};
use crate::{crypto::{Public as TraitPublic, UncheckedFrom, CryptoType, Derive}};
use runtime_interface::pass_by::PassByInner;
use rstd::ops::Deref;
use sp_std::ops::Deref;
/// A secret seed. It's not called a "secret key" because ring doesn't expose the secret keys
/// of the key pair (yeah, dumb); as such we're forced to remember the seed manually if we
@@ -94,7 +94,7 @@ impl Deref for Public {
}
}
impl rstd::convert::TryFrom<&[u8]> for Public {
impl sp_std::convert::TryFrom<&[u8]> for Public {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -155,15 +155,15 @@ impl std::fmt::Display for Public {
}
}
impl rstd::fmt::Debug for Public {
impl sp_std::fmt::Debug for Public {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
let s = self.to_ss58check();
write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8])
}
#[cfg(not(feature = "std"))]
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
Ok(())
}
}
@@ -187,7 +187,7 @@ impl<'de> Deserialize<'de> for Public {
#[derive(Encode, Decode, PassByInner)]
pub struct Signature(pub [u8; 64]);
impl rstd::convert::TryFrom<&[u8]> for Signature {
impl sp_std::convert::TryFrom<&[u8]> for Signature {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -270,22 +270,22 @@ impl AsMut<[u8]> for Signature {
}
}
impl rstd::fmt::Debug for Signature {
impl sp_std::fmt::Debug for Signature {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
write!(f, "{}", crate::hexdisplay::HexDisplay::from(&self.0))
}
#[cfg(not(feature = "std"))]
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
Ok(())
}
}
#[cfg(feature = "full_crypto")]
impl rstd::hash::Hash for Signature {
fn hash<H: rstd::hash::Hasher>(&self, state: &mut H) {
rstd::hash::Hash::hash(&self.0[..], state);
impl sp_std::hash::Hash for Signature {
fn hash<H: sp_std::hash::Hasher>(&self, state: &mut H) {
sp_std::hash::Hash::hash(&self.0[..], state);
}
}
+4 -4
View File
@@ -24,8 +24,8 @@ impl<'a> HexDisplay<'a> {
pub fn from<R: AsBytesRef>(d: &'a R) -> Self { HexDisplay(d.as_bytes_ref()) }
}
impl<'a> rstd::fmt::Display for HexDisplay<'a> {
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> Result<(), rstd::fmt::Error> {
impl<'a> sp_std::fmt::Display for HexDisplay<'a> {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> Result<(), sp_std::fmt::Error> {
if self.0.len() < 1027 {
for byte in self.0 {
f.write_fmt(format_args!("{:02x}", byte))?;
@@ -43,8 +43,8 @@ impl<'a> rstd::fmt::Display for HexDisplay<'a> {
}
}
impl<'a> rstd::fmt::Debug for HexDisplay<'a> {
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> Result<(), rstd::fmt::Error> {
impl<'a> sp_std::fmt::Debug for HexDisplay<'a> {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> Result<(), sp_std::fmt::Error> {
for byte in self.0 {
f.write_fmt(format_args!("{:02x}", byte))?;
}
+7 -7
View File
@@ -31,8 +31,8 @@ macro_rules! map {
);
}
use rstd::prelude::*;
use rstd::ops::Deref;
use sp_std::prelude::*;
use sp_std::ops::Deref;
#[cfg(feature = "std")]
use std::borrow::Cow;
#[cfg(feature = "std")]
@@ -87,7 +87,7 @@ pub use self::hasher::blake2::Blake2Hasher;
pub use primitives_storage as storage;
#[doc(hidden)]
pub use rstd;
pub use sp_std;
/// Context for executing a call into the runtime.
pub enum ExecutionContext {
@@ -147,7 +147,7 @@ impl OpaqueMetadata {
}
}
impl rstd::ops::Deref for OpaqueMetadata {
impl sp_std::ops::Deref for OpaqueMetadata {
type Target = Vec<u8>;
fn deref(&self) -> &Self::Target {
@@ -165,8 +165,8 @@ pub enum NativeOrEncoded<R> {
}
#[cfg(feature = "std")]
impl<R: codec::Encode> rstd::fmt::Debug for NativeOrEncoded<R> {
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
impl<R: codec::Encode> sp_std::fmt::Debug for NativeOrEncoded<R> {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
hexdisplay::HexDisplay::from(&self.as_encoded().as_ref()).fmt(f)
}
}
@@ -305,7 +305,7 @@ pub fn to_substrate_wasm_fn_return_value(value: &impl Encode) -> u64 {
// Leak the output vector to avoid it being freed.
// This is fine in a WASM context since the heap
// will be discarded after the call.
rstd::mem::forget(encoded);
sp_std::mem::forget(encoded);
res
}
@@ -17,7 +17,7 @@
//! Offchain workers types
use codec::{Encode, Decode};
use rstd::{prelude::{Vec, Box}, convert::TryFrom};
use sp_std::{prelude::{Vec, Box}, convert::TryFrom};
use crate::RuntimeDebug;
use runtime_interface::pass_by::{PassByCodec, PassByInner, PassByEnum};
+1 -1
View File
@@ -17,7 +17,7 @@
//! Definition of a sandbox environment.
use codec::{Encode, Decode};
use rstd::vec::Vec;
use sp_std::vec::Vec;
/// Error error that can be returned from host function.
#[derive(Encode, Decode)]
+13 -13
View File
@@ -21,7 +21,7 @@
//! for this to work.
// end::description[]
#[cfg(feature = "full_crypto")]
use rstd::vec::Vec;
use sp_std::vec::Vec;
#[cfg(feature = "full_crypto")]
use schnorrkel::{signing_context, ExpansionMode, Keypair, SecretKey, MiniSecretKey, PublicKey,
derive::{Derivation, ChainCode, CHAIN_CODE_LENGTH}
@@ -42,7 +42,7 @@ use crate::crypto::Ss58Codec;
use crate::{crypto::{Public as TraitPublic, UncheckedFrom, CryptoType, Derive}};
use crate::hash::{H256, H512};
use codec::{Encode, Decode};
use rstd::ops::Deref;
use sp_std::ops::Deref;
#[cfg(feature = "std")]
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
@@ -121,7 +121,7 @@ impl std::str::FromStr for Public {
}
}
impl rstd::convert::TryFrom<&[u8]> for Public {
impl sp_std::convert::TryFrom<&[u8]> for Public {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -154,15 +154,15 @@ impl std::fmt::Display for Public {
}
}
impl rstd::fmt::Debug for Public {
impl sp_std::fmt::Debug for Public {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
let s = self.to_ss58check();
write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8])
}
#[cfg(not(feature = "std"))]
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
Ok(())
}
}
@@ -188,7 +188,7 @@ impl<'de> Deserialize<'de> for Public {
#[derive(Encode, Decode, PassByInner)]
pub struct Signature(pub [u8; 64]);
impl rstd::convert::TryFrom<&[u8]> for Signature {
impl sp_std::convert::TryFrom<&[u8]> for Signature {
type Error = ();
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
@@ -278,22 +278,22 @@ impl From<schnorrkel::Signature> for Signature {
}
}
impl rstd::fmt::Debug for Signature {
impl sp_std::fmt::Debug for Signature {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
write!(f, "{}", crate::hexdisplay::HexDisplay::from(&self.0))
}
#[cfg(not(feature = "std"))]
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
Ok(())
}
}
#[cfg(feature = "full_crypto")]
impl rstd::hash::Hash for Signature {
fn hash<H: rstd::hash::Hasher>(&self, state: &mut H) {
rstd::hash::Hash::hash(&self.0[..], state);
impl sp_std::hash::Hash for Signature {
fn hash<H: sp_std::hash::Hasher>(&self, state: &mut H) {
sp_std::hash::Hash::hash(&self.0[..], state);
}
}
+2 -2
View File
@@ -184,7 +184,7 @@ macro_rules! wasm_export_functions {
&[0u8; 0]
} else {
unsafe {
$crate::rstd::slice::from_raw_parts(input_data, input_len)
$crate::sp_std::slice::from_raw_parts(input_data, input_len)
}
};
@@ -212,7 +212,7 @@ macro_rules! wasm_export_functions {
&[0u8; 0]
} else {
unsafe {
$crate::rstd::slice::from_raw_parts(input_data, input_len)
$crate::sp_std::slice::from_raw_parts(input_data, input_len)
}
};