Trait RuntimeNum

Source
pub trait RuntimeNum:
    Sortable
    + Copy
    + HasCompact<Type: DecodeWithMemTracking>
    + Default
    + CrossEnvType { }
Expand description

Deterministic, compact, persistable numeric type for runtime quantities.

Extends Sortable with numeric ergonomics:

  • Copy for primitive-like bitwise copy semantics
  • [HasCompact] for efficient numeric SCALE encoding by truncating unused bits
  • Default for a canonical zero-like value for instantiation
  • CrossEnvType to ensure safe portability across no_std runtime and native (std) environments, enabling optional serialization (e.g. serde) and thread-safe usage in off-chain, RPC, or testing contexts.

These guarantees make the type safe for repeated arithmetic, deterministic ordering, compact persistence, and cross-environment interoperability within runtime logic.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> RuntimeNum for T
where T: Sortable + Copy + HasCompact<Type: DecodeWithMemTracking> + Default + CrossEnvType,