mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 05:37:58 +00:00
ed5b78eaf0
* `decl_storage` parsing of the macro (TODO change tool crate structure) * Start formatting, for now use inner macro. Still missing optional formating last part (genesis ...). * Calling extra genesis macro * decl_storage lines parsing. * genesis macro as quote (need some cleaning reorg) * dirty $crate substitute * proc crate reorg. * PR impl : skip usage of phantom data, it only applies in test and council (others required it). * Remaining macro of decl_storage, warning stringify behave sometime oddly. * Formatting code and some cleaning. * Include line parsing to main struct (cannot use existing macro anymore). * Remove genesis phantom data when there is already a field with type parameter. * Revert wasm files * Remove old version of `decl_storage`. * Fix false positive for phantom trait (additional type check on config build). * slight changes: - return token errors instead of panic - do not use useless intermediate vec * Update srml/support/procedural/tools/derive/src/lib.rs remove indent Co-Authored-By: cheme <emericchevalier.pro@gmail.com> * Switch iterations to fold, remove unused import.
133 lines
2.9 KiB
Rust
133 lines
2.9 KiB
Rust
// Copyright 2017-2018 Parity Technologies (UK) Ltd.
|
|
// This file is part of Substrate.
|
|
|
|
// Substrate is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Substrate is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//! Support code for the runtime.
|
|
|
|
#![cfg_attr(not(feature = "std"), no_std)]
|
|
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
|
|
|
#[cfg(feature = "std")]
|
|
extern crate serde;
|
|
|
|
#[doc(hidden)]
|
|
pub extern crate sr_std as rstd;
|
|
extern crate sr_io as runtime_io;
|
|
#[doc(hidden)]
|
|
pub extern crate sr_primitives as runtime_primitives;
|
|
extern crate srml_metadata;
|
|
|
|
extern crate mashup;
|
|
|
|
#[macro_use]
|
|
extern crate srml_support_procedural;
|
|
|
|
#[cfg(test)]
|
|
#[macro_use]
|
|
extern crate pretty_assertions;
|
|
#[cfg(feature = "std")]
|
|
#[macro_use]
|
|
extern crate serde_derive;
|
|
#[cfg(test)]
|
|
#[macro_use]
|
|
extern crate parity_codec_derive;
|
|
|
|
#[doc(hidden)]
|
|
pub extern crate parity_codec as codec;
|
|
pub use self::storage::generator::Storage as GenericStorage;
|
|
|
|
#[macro_use]
|
|
pub mod dispatch;
|
|
#[macro_use]
|
|
pub mod storage;
|
|
mod hashable;
|
|
#[macro_use]
|
|
pub mod event;
|
|
#[macro_use]
|
|
mod origin;
|
|
#[macro_use]
|
|
pub mod metadata;
|
|
#[macro_use]
|
|
mod runtime;
|
|
#[macro_use]
|
|
pub mod inherent;
|
|
|
|
pub use self::storage::{StorageVec, StorageList, StorageValue, StorageMap};
|
|
pub use self::hashable::Hashable;
|
|
pub use self::dispatch::{Parameter, Dispatchable, Callable, IsSubType};
|
|
pub use self::metadata::RuntimeMetadata;
|
|
pub use runtime_io::print;
|
|
|
|
#[doc(inline)]
|
|
pub use srml_support_procedural::decl_storage;
|
|
|
|
#[macro_export]
|
|
macro_rules! fail {
|
|
( $y:expr ) => {{
|
|
return Err($y);
|
|
}}
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! ensure {
|
|
( $x:expr, $y:expr ) => {{
|
|
if !$x {
|
|
fail!($y);
|
|
}
|
|
}}
|
|
}
|
|
|
|
#[macro_export]
|
|
#[cfg(feature = "std")]
|
|
macro_rules! assert_noop {
|
|
( $x:expr , $y:expr ) => {
|
|
let h = runtime_io::storage_root();
|
|
assert_err!($x, $y);
|
|
assert_eq!(h, runtime_io::storage_root());
|
|
}
|
|
}
|
|
|
|
#[macro_export]
|
|
#[cfg(feature = "std")]
|
|
macro_rules! assert_err {
|
|
( $x:expr , $y:expr ) => {
|
|
assert_eq!($x, Err($y));
|
|
}
|
|
}
|
|
|
|
#[macro_export]
|
|
#[cfg(feature = "std")]
|
|
macro_rules! assert_ok {
|
|
( $x:expr ) => {
|
|
assert_eq!($x, Ok(()));
|
|
};
|
|
( $x:expr, $y:expr ) => {
|
|
assert_eq!($x, Ok($y));
|
|
}
|
|
}
|
|
|
|
/// The void type - it cannot exist.
|
|
// Oh rust, you crack me up...
|
|
#[derive(Clone, Eq, PartialEq)]
|
|
#[cfg_attr(feature = "std", derive(Debug))]
|
|
pub enum Void {}
|
|
|
|
#[doc(hidden)]
|
|
pub use mashup::*;
|
|
|
|
#[cfg(feature = "std")]
|
|
#[doc(hidden)]
|
|
pub use serde_derive::*;
|