reintroduce slicable to primitives

This commit is contained in:
Robert Habermeier
2018-02-05 16:15:45 +01:00
parent e4e755a87a
commit 2bc7c57359
9 changed files with 351 additions and 56 deletions
+17
View File
@@ -40,6 +40,7 @@ extern crate uint as uint_crate;
#[cfg(feature = "std")]
extern crate core;
extern crate polkadot_runtime_codec as codec;
#[cfg(test)]
extern crate polkadot_serializer;
#[cfg(test)]
@@ -50,6 +51,16 @@ extern crate pretty_assertions;
#[macro_use]
extern crate alloc;
// TODO: factor out to separate crate.
macro_rules! try_opt {
($e: expr) => {
match $e {
Some(x) => x,
None => return None,
}
}
}
mod bytes;
pub mod block;
pub mod contract;
@@ -95,6 +106,12 @@ pub type Hash = [u8; 32];
/// Alias to 520-bit hash when used in the context of a signature.
pub type Signature = hash::H512;
/// A balance in the staking subsystem.
pub type Balance = u64;
/// A timestamp.
pub type Timestamp = u64;
/// A hash function.
pub fn hash(data: &[u8]) -> hash::H256 {
blake2_256(data).into()