Module base

Source
Expand description

Defines the foundational trait system for deterministic, codec-safe, and metadata-aware types used across the runtime.

Each trait represents a specific capability (e.g. encoding, ordering, bounded size), and higher-level traits build on top of them.

Instead of directly depending on low-level traits (e.g. Encode, TypeInfo), downstream code should prefer these abstractions to ensure consistency, safety, and clarity across the codebase.

Traitsยง

Asset
Unsigned arithmetic-capable quantity used for balances and financial logic.
Buffer
Deterministic, codec-safe growable buffer for transient runtime aggregation.
Collection
A generic iterable, indexable sequence supporting deterministic traversal.
Countable
Unsigned, low-precision quantity for user-scale counts and limits.
CrossEnvType
Cross-environment portable runtime type usable in both std and no_std.
Delimited
Strictly size-bounded and lifetime-independent runtime type for persistence.
Elastic
Upper-bounded encoded-size runtime type with flexible internal structure.
Fractional
Deterministic fixed-point numeric type for fractional runtime arithmetic.
Growable
A growable collection supporting construction, incremental accumulation, and empty initialization.
Indexable
Slice-like container providing direct indexed and range-based access.
Keyed
Persistable runtime value representing a stable identity/key.
MetaAware
Metadata-aware type that can be described in runtime metadata.
Percentage
Deterministic fixed-precision percentage / ratio for runtime arithmetic.
Portable
Codec-safe and cloneable type portable across runtime boundaries.
Probe
Deterministic, encode-only probe value for canonical byte-level matching.
RuntimeEnum
Codec-safe, metadata-aware enum-like runtime type representing named states.
RuntimeError
Persistable, codec-safe runtime error convertible into [DispatchError].
RuntimeNum
Deterministic, compact, persistable numeric type for runtime quantities.
RuntimeType
Deterministic, portable, and metadata-aware domain type for no_std runtimes.
Sortable
Persistable, orderable, strictly bounded type for multi-instance comparison.
Storable
Lifetime-independent, fully owned runtime type safe for on-chain storage.
Time
Unsigned temporal quantity for block numbers, timestamps, and durations.