mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 14:41:11 +00:00
sp-std removal from substrate/primitives (#3274)
This PR removes sp-std crate from substrate/primitives sub-directories. For now crates that have `pub use` of sp-std or export macros that would necessitate users of the macros to `extern crate alloc` have been excluded from this PR. There should be no breaking changes in this PR. --------- Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use sp_std::{boxed::Box, vec::Vec};
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
|
||||
/// Error type used for trie related errors.
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub mod cache;
|
||||
mod error;
|
||||
@@ -33,6 +35,8 @@ mod trie_stream;
|
||||
#[cfg(feature = "std")]
|
||||
pub mod proof_size_extension;
|
||||
|
||||
use alloc::{borrow::Borrow, boxed::Box, vec, vec::Vec};
|
||||
use core::marker::PhantomData;
|
||||
/// Our `NodeCodec`-specific error.
|
||||
pub use error::Error;
|
||||
/// Various re-exports from the `hash-db` crate.
|
||||
@@ -42,7 +46,6 @@ use hash_db::{Hasher, Prefix};
|
||||
pub use memory_db::{prefixed_key, HashKey, KeyFunction, PrefixedKey};
|
||||
/// The Substrate format implementation of `NodeCodec`.
|
||||
pub use node_codec::NodeCodec;
|
||||
use sp_std::{borrow::Borrow, boxed::Box, marker::PhantomData, vec::Vec};
|
||||
pub use storage_proof::{CompactProof, StorageProof};
|
||||
/// Trie codec reexport, mainly child trie support
|
||||
/// for trie compact proof.
|
||||
@@ -500,7 +503,7 @@ pub struct KeySpacedDBMut<'a, DB: ?Sized, H>(&'a mut DB, &'a [u8], PhantomData<H
|
||||
/// Utility function used to merge some byte data (keyspace) and `prefix` data
|
||||
/// before calling key value database primitives.
|
||||
fn keyspace_as_prefix_alloc(ks: &[u8], prefix: Prefix) -> (Vec<u8>, Option<u8>) {
|
||||
let mut result = sp_std::vec![0; ks.len() + prefix.0.len()];
|
||||
let mut result = vec![0; ks.len() + prefix.0.len()];
|
||||
result[..ks.len()].copy_from_slice(ks);
|
||||
result[ks.len()..].copy_from_slice(prefix.0);
|
||||
(result, prefix.1)
|
||||
|
||||
@@ -19,9 +19,10 @@
|
||||
|
||||
use super::node_header::{NodeHeader, NodeKind};
|
||||
use crate::{error::Error, trie_constants};
|
||||
use alloc::{borrow::Borrow, vec::Vec};
|
||||
use codec::{Compact, Decode, Encode, Input};
|
||||
use core::{marker::PhantomData, ops::Range};
|
||||
use hash_db::Hasher;
|
||||
use sp_std::{borrow::Borrow, marker::PhantomData, ops::Range, vec::Vec};
|
||||
use trie_db::{
|
||||
nibble_ops,
|
||||
node::{NibbleSlicePlan, NodeHandlePlan, NodePlan, Value, ValuePlan},
|
||||
@@ -30,7 +31,7 @@ use trie_db::{
|
||||
|
||||
/// Helper struct for trie node decoder. This implements `codec::Input` on a byte slice, while
|
||||
/// tracking the absolute position. This is similar to `std::io::Cursor` but does not implement
|
||||
/// `Read` and `io` is not in `sp-std`.
|
||||
/// `Read` and `io` are not in `core` or `alloc`.
|
||||
struct ByteSliceInput<'a> {
|
||||
data: &'a [u8],
|
||||
offset: usize,
|
||||
|
||||
@@ -15,14 +15,12 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use alloc::{collections::btree_set::BTreeSet, vec::Vec};
|
||||
use codec::{Decode, Encode};
|
||||
use core::iter::{DoubleEndedIterator, IntoIterator};
|
||||
use hash_db::{HashDB, Hasher};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_std::{
|
||||
collections::btree_set::BTreeSet,
|
||||
iter::{DoubleEndedIterator, IntoIterator},
|
||||
vec::Vec,
|
||||
};
|
||||
|
||||
// Note that `LayoutV1` usage here (proof compaction) is compatible
|
||||
// with `LayoutV0`.
|
||||
use crate::LayoutV1 as Layout;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//! it to substrate specific layout and child trie system.
|
||||
|
||||
use crate::{CompactProof, HashDBT, TrieConfiguration, TrieHash, EMPTY_PREFIX};
|
||||
use sp_std::{boxed::Box, vec::Vec};
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
use trie_db::{CError, Trie};
|
||||
|
||||
/// Error for trie node decoding.
|
||||
|
||||
@@ -21,9 +21,9 @@ use crate::{
|
||||
node_header::{size_and_prefix_iterator, NodeKind},
|
||||
trie_constants,
|
||||
};
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Compact, Encode};
|
||||
use hash_db::Hasher;
|
||||
use sp_std::vec::Vec;
|
||||
use trie_root;
|
||||
|
||||
/// Codec-flavored TrieStream.
|
||||
|
||||
Reference in New Issue
Block a user