Module sp_runtime::traits
source · Expand description
Primitives for the runtime modules.
Structs§
- A lookup implementation returning the
AccountIdfrom aMultiAddress. - Input that adds infinite number of zero after wrapped input.
- An error type that indicates that the origin is invalid.
- Blake2-256 Hash implementation.
- A
TryMorphimplementation to reduce a scalar by a particular amount, checking for underflow. - A structure that performs standard conversion using the standard Rust conversion traits.
- A structure that performs identity conversion.
- A lookup implementation returning the input value.
- Keccak-256 Hash implementation.
- An error that indicates that a lookup failed.
- Implementation of
Morphwhich converts between types usingInto. - A
TryMorphimplementation to enforce an upper limit for a result of the outer morphed type. - Mutator which reduces a scalar by a particular amount.
- Morpher to disregard the source value and replace with another.
- Morpher to disregard the source value and replace with the default of
V. - Information about a
SignedExtensionfor the runtime metadata. - Implementation of
Morphto retrieve just the first element of a tuple. - Input that adds infinite number of zero after wrapped input.
- A structure that performs standard conversion using the standard Rust conversion traits.
- Implementation of
TryMorphwhich attempts to convert between types usingTryInto.
Traits§
- This type can be converted into and possibly from an AccountId (which itself is generic).
- Means of signature verification of an application key.
- An “executable” piece of information, used by the standard Substrate Executive in order to enact a piece of extrinsic information by marshalling and dispatching to a named function call.
- A meta trait for arithmetic.
- A meta trait for arithmetic. Same as
AtLeast32Bit, but also bounded to be unsigned. - A “checkable” piece of information, used by the standard Substrate Executive in order to check the validity of a piece of extrinsic information, usually by verifying the signature. Implement for pieces of information that don’t require additional context in order to be checked.
- Something which fulfills the abstract idea of a Substrate block. It has types for
Extrinsicpieces of information as well as aHeader. - Something that can convert a
BlockIdto a number or a hash. - Super trait with all the attributes for a block number.
- Get current block number
- Numbers which have upper and lower bounds
- Something that can be checked for equality and printed out to a debug channel if bad.
- Extract the digest type for a block. A “checkable” piece of information, used by the standard Substrate Executive in order to check the validity of a piece of extrinsic information, usually by verifying the signature. Implement for pieces of information that require some additional context
Contextin order to be checked. - Performs addition that returns
Noneinstead of wrapping around on overflow. - Convenience type to work around the highly unergonomic syntax needed to invoke the functions of overloaded generic traits, in this case
TryFromandTryInto. - Performs division that returns
Noneinstead of panicking on division by zero and instead of wrapping around on underflow and overflow. - Performs multiplication that returns
Noneinstead of wrapping around on underflow or overflow. - Performs a left shift that returns
Noneon shifts larger than or equal to the type width. - Performs a right shift that returns
Noneon shifts larger than or equal to the type width. - Performs subtraction that returns
Noneinstead of wrapping around on underflow. - Trait for things that can be clear (have no bits set). For numeric types, essentially the same as
Zero. - Infallible conversion trait. Generic over both source and destination types.
- Reversing infallible conversion trait. Generic over both source and destination types.
- A lazy call (module function and argument values) that can be executed via its
dispatchmethod. - Performs addition that returns
ArithmeticErrorinstead of wrapping around on overflow. - Performs self addition that returns
ArithmeticErrorinstead of wrapping around on overflow. - Performs division that returns
ArithmeticErrorinstead of wrapping around on overflow. - Performs self division that returns
ArithmeticErrorinstead of wrapping around on overflow. - Extends
FixedPointNumberwith the Ensure family functions. - Similar to
TryFrombut returning anArithmeticErrorerror. - Similar to
TryIntobut returning anArithmeticErrorerror. - Performs multiplication that returns
ArithmeticErrorinstead of wrapping around on overflow. - Performs self multiplication that returns
ArithmeticErrorinstead of wrapping around on overflow. - Meta trait that supports all immutable arithmetic
Ensure*operations - Meta trait that supports all assigned arithmetic
Ensure*operations - Performs subtraction that returns
ArithmeticErrorinstead of wrapping around on underflow. - Performs self subtraction that returns
ArithmeticErrorinstead of wrapping around on underflow. - Something that acts like an
Extrinsic. - Implementor is an
Extrinsicand provides metadata about this extrinsic. - A marker trait for something that knows the type of the node block.
- A marker trait for something that knows the type of the runtime block.
- Abstraction around hashing
- Super trait with all the attributes for a hashing output.
- Something which fulfills the abstract idea of a Substrate header. It has types for a
Number, aHashand aHashing. It provides access to anextrinsics_root,state_rootandparent_hash, as well as adigestand a blocknumber. - Some type that is able to be collapsed into an account ID. It is not possible to recreate the original value from the account ID.
- A trait implementing integer square root.
- Determine if a
MemberIdis a valid member. - A lazy value.
- Means of changing one type into another in a manner dependent on the source type.
- Fallible conversion trait returning an Option. Generic over both source and destination types.
- Reversing fallible conversion trait returning an Option. Generic over both source and destination types.
- A type that implements Display when in std environment.
- Definition for a bi-directional, fallible conversion between two types.
- A type that implements FromStr when in std environment.
- A type that implements Hash when in std environment.
- A type that implements Serialize when in std environment or serde feature is activated.
- A type that implements Serialize, DeserializeOwned and Debug when in std environment or serde feature is activated.
- A type that can be used in runtime structures.
- Extensible conversion trait. Generic over only source type, with destination type being associated.
- Defines a multiplicative identity element for
Self. - Opaque data type that may be destructured into a series of raw byte slices (which represent individual keys).
- Trait for things which can be printed from the runtime.
- Convenience type to work around the highly unergonomic syntax needed to invoke the functions of overloaded generic traits, in this case
SaturatedFromandSaturatedInto. - Saturating arithmetic operations, returning maximum or minimum values instead of overflowing.
- Multiply and divide by a number that isn’t necessarily the same type. Basically just the same as
MulandDivexcept it can be used for all basic numeric types. - Something that acts like a
SignaturePayloadof anExtrinsic. - Means by which a transaction may be extended. This type embodies both the data and the logic that should be additionally associated with the transaction. It should be plain old data.
- A meta trait for all bit ops.
- Means of changing one type into another in a manner dependent on the source type. This variant is different to
Lookupin that it doesn’t (can cannot) require any context. - Fallible conversion trait which returns the argument in the case of being unable to convert. Generic over both source and destination types.
- Reversing fallible conversion trait which returns the argument in the case of being unable to convert back. Generic over both source and destination types.
- Extensible conversion trait. Generic over only source type, with destination type being associated.
- Just like
Fromexcept that if the source value is too big to fit into the destination type then it’ll saturate the destination. - Just like
Intoexcept that if the source value is too big to fit into the destination type then it’ll saturate the destination. - Provide validation for unsigned extrinsics.
- Means of signature verification.
- Defines an additive identity element for
Self.
Functions§
- Raises a value to the power of exp, returning
Noneif an overflow occurred. - Raises a value to the power of exp, returning
ArithmeticErrorif an overflow occurred.
Type Aliases§
- Shortcut to reference the
Infotype of aDispatchable. - Extract the hashing type for a block.
- Extract the number type for a block.
- Shortcut to reference the
PostInfotype of aDispatchable.