Crate sp_core

Source
Expand description

Shareable Substrate types.

Re-exports§

pub use self::hash::convert_hash;
pub use crypto::ByteArray;
pub use crypto::DeriveJunction;
pub use crypto::Pair;
pub use crypto::Public;
pub use serde;
pub use sp_crypto_hashing as hashing;
pub use paste;
pub use bounded_collections as bounded;
pub use sp_storage as storage;

Modules§

bounded_btree_map
Traits, types and structs to support a bounded BTreeMap.
bounded_vec
Traits, types and structs to support putting a bounded vector into storage, as a raw value, map or a double map.
const_hex2array
Provides a const function for converting a hex string to a u8 array at compile time, when used in the proper context.
crypto
Cryptographic utilities.
crypto_bytes
Generic byte array which can be specialized with a marker type.
defer
Contains the crate::defer! macro for deferring the execution of code until the current scope is dropped. This helps with always executing cleanup code.
ecdsa
Simple ECDSA secp256k1 API.
ed25519
Simple Ed25519 API.
hash
A fixed hash type.
hexdisplay
Wrapper type for byte collections that outputs hex.
offchain
Offchain workers types
paired_crypto
API for using a pair of crypto schemes together.
sr25519
Simple sr25519 (Schnorr-Ristretto) API.
testing
Types that should only be used for testing!
traits
Shareable Substrate traits.
uint
An unsigned fixed-size integer.

Macros§

bounded_btree_map
Build a bounded btree-map from the given literals.
bounded_vec
Build a bounded vec from the given literals.
defer
Executes the given code when the current scope is dropped.
generate_feature_enabled_macro
Generates a macro for checking if a certain feature is enabled.
hex2array
Provides a const array from given string literal.
impl_maybe_marker
Macro for creating Maybe* marker traits.
impl_maybe_marker_std_or_serde
Macro for creating Maybe* marker traits.
map
Initialize a key-value collection from array.
parameter_types
Create new implementations of the Get trait.
wasm_export_functions
Macro for exporting functions from wasm in with the expected signature for using it with the wasm executor. This is useful for tests where you need to call a function in wasm.

Structs§

Blake2Hasher
Concrete implementation of Hasher using Blake2b 256-bit hashes
Bytes
Hex-serialized shim for Vec<u8>.
ConstBool
Const getter for a basic type.
ConstI8
Const getter for a basic type.
ConstI16
Const getter for a basic type.
ConstI32
Const getter for a basic type.
ConstI64
Const getter for a basic type.
ConstI128
Const getter for a basic type.
ConstU8
Const getter for a basic type.
ConstU16
Const getter for a basic type.
ConstU32
Const getter for a basic type.
ConstU64
Const getter for a basic type.
ConstU128
Const getter for a basic type.
GetDefault
Implement Get by returning Default for any type that implements Default.
H160
Fixed-size uninterpreted hash type with 20 bytes (160 bits) size.
H256
Fixed-size uninterpreted hash type with 32 bytes (256 bits) size.
H512
Fixed-size uninterpreted hash type with 64 bytes (512 bits) size.
KeccakHasher
Concrete implementation of Hasher using Keccak 256-bit hashes
OpaqueMetadata
Stores the encoded RuntimeMetadata for the native side as opaque type.
OpaquePeerId
Simple blob to hold a PeerId without committing to its format.
U256
Little-endian large integer type 256-bit unsigned integer.
U512
Little-endian large integer type 512-bits unsigned integer.

Enums§

LogLevel
A log level matching the one from log crate.
LogLevelFilter
Log level filter that expresses which log levels should be filtered.
Void
The void type - it cannot exist.

Constants§

MAX_POSSIBLE_ALLOCATION
The maximum number of bytes that can be allocated at one time.

Traits§

Get
A trait for querying a single value from a type.
Hasher
Trait describing an object that can hash a slice of bytes. Used to abstract other types over the hashing algorithm. Defines a single hash method and an Out associated type with the necessary bounds.
TryCollect
Try and collect into a collection C.
TypeId
Provide a simple 4 byte identifier for a type.
TypedGet
A trait for querying a single value from a type defined in the trait.

Functions§

blake2_64
Do a Blake2 64-bit hash and return result.
blake2_128
Do a Blake2 128-bit hash and return result.
blake2_256
Do a Blake2 256-bit hash and return result.
blake2_512
Do a Blake2 512-bit hash and return result.
blake2_512_into
Do a Blake2 512-bit hash and place result in dest.
keccak_256
Do a keccak 256-bit hash and return result.
keccak_512
Do a keccak 512-bit hash and return result.
sha2_256
Do a sha2 256-bit hash and return result.
twox_64
Do a XX 64-bit hash and return result.
twox_64_into
Do a XX 64-bit hash and place result in dest.
twox_128
Do a XX 128-bit hash and return result.
twox_256
Do a XX 256-bit hash and return result.
twox_128_into
Do a XX 128-bit hash and place result in dest.
twox_256_into
Do a XX 256-bit hash and place result in dest.

Derive Macros§

RuntimeDebug