remove prelude from core, use alloc directly

This commit is contained in:
Tadeo hepperle
2024-02-02 09:42:24 +01:00
parent 6236c49e3c
commit e427529341
25 changed files with 63 additions and 124 deletions
+4 -4
View File
@@ -6,12 +6,12 @@
//! This doesn't contain much functionality itself, but is easy to convert to/from an `sp_core::AccountId32`
//! for instance, to gain functionality without forcing a dependency on Substrate crates here.
use crate::prelude::*;
use alloc::string::String;
use alloc::vec;
use alloc::vec::Vec;
use codec::{Decode, Encode};
use derive_more::Display;
use serde::{Deserialize, Serialize};
use string::String;
use vec::Vec;
/// A 32-byte cryptographic identifier. This is a simplified version of Substrate's
/// `sp_core::crypto::AccountId32`. To obtain more functionality, convert this into
@@ -145,7 +145,7 @@ impl<'de> Deserialize<'de> for AccountId32 {
D: serde::Deserializer<'de>,
{
AccountId32::from_ss58check(&String::deserialize(deserializer)?)
.map_err(|e| serde::de::Error::custom(format!("{e:?}")))
.map_err(|e| serde::de::Error::custom(alloc::format!("{e:?}")))
}
}
+2 -2
View File
@@ -4,7 +4,8 @@
//! Generic `scale_bits` over `bitvec`-like `BitOrder` and `BitFormat` types.
use crate::prelude::*;
use alloc::vec;
use alloc::vec::Vec;
use codec::{Compact, Input};
use core::marker::PhantomData;
use scale_bits::{
@@ -12,7 +13,6 @@ use scale_bits::{
Bits,
};
use scale_decode::IntoVisitor;
use vec::Vec;
/// Associates `bitvec::store::BitStore` trait with corresponding, type-erased `scale_bits::StoreFormat` enum.
///
+2 -3
View File
@@ -4,11 +4,10 @@
//! Miscellaneous utility helpers.
use crate::prelude::*;
use borrow::ToOwned;
use alloc::borrow::ToOwned;
use alloc::vec::Vec;
use codec::{Compact, Decode, Encode};
use derivative::Derivative;
use vec::Vec;
mod account_id;
pub mod bits;
+1 -2
View File
@@ -6,9 +6,8 @@
//! This doesn't contain much functionality itself, but is easy to convert to/from an `sp_runtime::MultiAddress`
//! for instance, to gain functionality without forcing a dependency on Substrate crates here.
use crate::prelude::*;
use alloc::vec::Vec;
use codec::{Decode, Encode};
use vec::Vec;
/// A multi-format address wrapper for on-chain accounts. This is a simplified version of Substrate's
/// `sp_runtime::MultiAddress`. To obtain more functionality, convert this into that type (this conversion
+1 -2
View File
@@ -2,11 +2,10 @@
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
// see LICENSE for license details.
use crate::prelude::*;
use alloc::vec::Vec;
use codec::{Decode, Encode};
use scale_decode::{visitor::DecodeAsTypeResult, IntoVisitor, Visitor};
use scale_encode::EncodeAsType;
use vec::Vec;
/// If the type inside this implements [`Encode`], this will implement [`scale_encode::EncodeAsType`].
/// If the type inside this implements [`Decode`], this will implement [`scale_decode::DecodeAsType`].
+1 -2
View File
@@ -10,11 +10,10 @@
//! bytes to be re-encoded (length prefixed).
use super::{Encoded, Static};
use crate::prelude::*;
use alloc::vec::Vec;
use codec::{Decode, Encode};
use core::marker::PhantomData;
use scale_decode::{visitor::DecodeAsTypeResult, DecodeAsType, IntoVisitor, Visitor};
use vec::Vec;
/// The unchecked extrinsic from substrate.
#[derive(Clone, Debug, Eq, PartialEq, Encode)]
+1 -2
View File
@@ -3,12 +3,11 @@
// see LICENSE for license details.
use super::PhantomDataSendSync;
use crate::prelude::*;
use alloc::vec::Vec;
use codec::{Compact, Decode, DecodeAll, Encode};
use derivative::Derivative;
use scale_decode::{IntoVisitor, Visitor};
use scale_encode::EncodeAsType;
use vec::Vec;
/// A wrapper for any type `T` which implement encode/decode in a way compatible with `Vec<u8>`.
/// [`WrapperKeepOpaque`] stores the type only in its opaque format, aka as a `Vec<u8>`. To