mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 05:11:02 +00:00
more idiomatic std features
This commit is contained in:
Generated
+1
@@ -748,6 +748,7 @@ dependencies = [
|
|||||||
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fixed-hash 0.1.0 (git+https://github.com/paritytech/primitives.git)",
|
"fixed-hash 0.1.0 (git+https://github.com/paritytech/primitives.git)",
|
||||||
|
"polkadot-runtime-codec 0.1.0",
|
||||||
"polkadot-serializer 0.1.0",
|
"polkadot-serializer 0.1.0",
|
||||||
"pretty_assertions 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pretty_assertions 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|||||||
@@ -9,6 +9,5 @@ runtime-std = { path = "./std", version = "0.1" }
|
|||||||
rustc-hex = "1.0"
|
rustc-hex = "1.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["with-std"]
|
default = ["std"]
|
||||||
with-std = []
|
std = ["polkadot-runtime-codec/std"]
|
||||||
without-std = ["polkadot-runtime-codec/no-std"]
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! The with-std support functions for the runtime.
|
//! The std support functions for the runtime.
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate environmental;
|
extern crate environmental;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ untrusted = "0.5"
|
|||||||
twox-hash = "1.1.0"
|
twox-hash = "1.1.0"
|
||||||
byteorder = "1.1"
|
byteorder = "1.1"
|
||||||
blake2-rfc = "0.2.18"
|
blake2-rfc = "0.2.18"
|
||||||
|
polkadot-runtime-codec = { path = "../runtime-codec", version = "0.1" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
polkadot-serializer = { path = "../serializer", version = "0.1" }
|
polkadot-serializer = { path = "../serializer", version = "0.1" }
|
||||||
@@ -22,4 +23,4 @@ pretty_assertions = "0.4"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = ["uint/std", "fixed-hash/std"]
|
std = ["uint/std", "fixed-hash/std", "polkadot-runtime-codec/std"]
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
no-std = []
|
std = []
|
||||||
default = []
|
default = ["std"]
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
//! Implements the serialization and deserialization codec for polkadot runtime
|
//! Implements the serialization and deserialization codec for polkadot runtime
|
||||||
//! values.
|
//! values.
|
||||||
|
|
||||||
#![cfg_attr(feature = "no-std", no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
#![cfg_attr(feature = "no-std", feature(alloc))]
|
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||||
|
|
||||||
mod endiansensitive;
|
mod endiansensitive;
|
||||||
mod slicable;
|
mod slicable;
|
||||||
@@ -32,7 +32,7 @@ pub use self::streamreader::StreamReader;
|
|||||||
pub use self::joiner::Joiner;
|
pub use self::joiner::Joiner;
|
||||||
pub use self::keyedvec::KeyedVec;
|
pub use self::keyedvec::KeyedVec;
|
||||||
|
|
||||||
#[cfg(feature = "no-std")]
|
#[cfg(not(feature = "std"))]
|
||||||
mod std {
|
mod std {
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
|||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
polkadot-runtime-codec = { path = "../../runtime-codec", version = "0.1" }
|
polkadot-runtime-codec = { path = "../../runtime-codec", version = "0.1", default-features = false}
|
||||||
runtime-std = { path = "../std", version = "0.1" }
|
runtime-std = { path = "../std", version = "0.1" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["without-std"]
|
default = []
|
||||||
with-std = []
|
std = ["polkadot-runtime-codec/std"]
|
||||||
without-std = ["polkadot-runtime-codec/no-std"]
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
//! The Polkadot runtime. This can be compiled with #[no_std], ready for Wasm.
|
//! The Polkadot runtime. This can be compiled with #[no_std], ready for Wasm.
|
||||||
|
|
||||||
#![cfg_attr(feature = "without-std", no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate runtime_std;
|
extern crate runtime_std;
|
||||||
|
|
||||||
#[cfg(feature = "with-std")]
|
#[cfg(feature = "std")]
|
||||||
extern crate rustc_hex;
|
extern crate rustc_hex;
|
||||||
|
|
||||||
extern crate polkadot_runtime_codec as codec;
|
extern crate polkadot_runtime_codec as codec;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use codec::{StreamReader, Joiner, Slicable, NonTrivialSlicable};
|
|||||||
use primitives::{Header, UncheckedTransaction};
|
use primitives::{Header, UncheckedTransaction};
|
||||||
|
|
||||||
/// A Polkadot relay chain block.
|
/// A Polkadot relay chain block.
|
||||||
#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))]
|
#[cfg_attr(feature = "std", derive(PartialEq, Debug))]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
/// The header of the block.
|
/// The header of the block.
|
||||||
pub header: Header,
|
pub header: Header,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
use runtime_std::prelude::*;
|
use runtime_std::prelude::*;
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))]
|
#[cfg_attr(feature = "std", derive(PartialEq, Debug))]
|
||||||
/// The digest of a block, useful for light-clients.
|
/// The digest of a block, useful for light-clients.
|
||||||
pub struct Digest {
|
pub struct Digest {
|
||||||
/// All logs that have happened in the block.
|
/// All logs that have happened in the block.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use runtime::{staking, session, timestamp, governance};
|
|||||||
|
|
||||||
/// Public functions that can be dispatched to.
|
/// Public functions that can be dispatched to.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))]
|
#[cfg_attr(feature = "std", derive(PartialEq, Debug))]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum Function {
|
pub enum Function {
|
||||||
StakingStake = 0,
|
StakingStake = 0,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use runtime_std::mem;
|
|||||||
use primitives::{BlockNumber, Hash, Digest};
|
use primitives::{BlockNumber, Hash, Digest};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))]
|
#[cfg_attr(feature = "std", derive(PartialEq, Debug))]
|
||||||
/// The header for a block.
|
/// The header for a block.
|
||||||
pub struct Header {
|
pub struct Header {
|
||||||
/// The parent block's "hash" (actually the Blake2-256 hash of its serialised header).
|
/// The parent block's "hash" (actually the Blake2-256 hash of its serialised header).
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ use runtime::{system, governance, staking, session};
|
|||||||
|
|
||||||
/// Internal functions that can be dispatched to.
|
/// Internal functions that can be dispatched to.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))]
|
#[cfg_attr(feature = "std", derive(PartialEq, Debug))]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum InternalFunction {
|
pub enum InternalFunction {
|
||||||
SystemSetCode = 0,
|
SystemSetCode = 0,
|
||||||
@@ -56,7 +56,7 @@ impl InternalFunction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An internal function.
|
/// An internal function.
|
||||||
#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))]
|
#[cfg_attr(feature = "std", derive(PartialEq, Debug))]
|
||||||
pub struct Proposal {
|
pub struct Proposal {
|
||||||
/// The priviledged function to call.
|
/// The priviledged function to call.
|
||||||
pub function: InternalFunction,
|
pub function: InternalFunction,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ use primitives::{AccountID, TxOrder, Function};
|
|||||||
use runtime_std::mem;
|
use runtime_std::mem;
|
||||||
|
|
||||||
/// A vetted and verified transaction from the external world.
|
/// A vetted and verified transaction from the external world.
|
||||||
#[cfg_attr(feature = "with-std", derive(PartialEq, Debug))]
|
#[cfg_attr(feature = "std", derive(PartialEq, Debug))]
|
||||||
pub struct Transaction {
|
pub struct Transaction {
|
||||||
/// Who signed it (note this is not a signature).
|
/// Who signed it (note this is not a signature).
|
||||||
pub signed: AccountID,
|
pub signed: AccountID,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use runtime_std::prelude::*;
|
|||||||
use codec::{Slicable, NonTrivialSlicable, StreamReader, Joiner};
|
use codec::{Slicable, NonTrivialSlicable, StreamReader, Joiner};
|
||||||
use primitives::Transaction;
|
use primitives::Transaction;
|
||||||
|
|
||||||
#[cfg(feature = "with-std")]
|
#[cfg(feature = "std")]
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// A transactions right from the external world. Unchecked.
|
/// A transactions right from the external world. Unchecked.
|
||||||
@@ -40,14 +40,14 @@ impl UncheckedTransaction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "with-std")]
|
#[cfg(feature = "std")]
|
||||||
impl PartialEq for UncheckedTransaction {
|
impl PartialEq for UncheckedTransaction {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.signature.iter().eq(other.signature.iter()) && self.transaction == other.transaction
|
self.signature.iter().eq(other.signature.iter()) && self.transaction == other.transaction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "with-std")]
|
#[cfg(feature = "std")]
|
||||||
impl fmt::Debug for UncheckedTransaction {
|
impl fmt::Debug for UncheckedTransaction {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "UncheckedTransaction({:?})", self.transaction)
|
write!(f, "UncheckedTransaction({:?})", self.transaction)
|
||||||
|
|||||||
@@ -19,16 +19,16 @@
|
|||||||
mod environment;
|
mod environment;
|
||||||
pub mod storage;
|
pub mod storage;
|
||||||
mod hashable;
|
mod hashable;
|
||||||
#[cfg(feature = "with-std")]
|
#[cfg(feature = "std")]
|
||||||
mod statichex;
|
mod statichex;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
#[cfg(feature = "with-std")]
|
#[cfg(feature = "std")]
|
||||||
mod testing;
|
mod testing;
|
||||||
|
|
||||||
pub use self::environment::with_env;
|
pub use self::environment::with_env;
|
||||||
pub use self::storage::StorageVec;
|
pub use self::storage::StorageVec;
|
||||||
pub use self::hashable::Hashable;
|
pub use self::hashable::Hashable;
|
||||||
#[cfg(feature = "with-std")]
|
#[cfg(feature = "std")]
|
||||||
pub use self::statichex::{StaticHexConversion, StaticHexInto};
|
pub use self::statichex::{StaticHexConversion, StaticHexInto};
|
||||||
#[cfg(feature = "with-std")]
|
#[cfg(feature = "std")]
|
||||||
pub use self::testing::{AsBytesRef, HexDisplay, TestExternalities, one, two};
|
pub use self::testing::{AsBytesRef, HexDisplay, TestExternalities, one, two};
|
||||||
|
|||||||
BIN
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user