Trait RuntimeEnum

Source
pub trait RuntimeEnum:
    FullCodec
    + TypeInfo
    + Debug { }
Expand description

Codec-safe, metadata-aware enum-like runtime type representing named states.

Unlike RuntimeType, this does not require Clone or Eq since such enums are primarily used to express distinct named variants (states) through their discriminants, not value semantics that rely on cloning or structural equality comparisons. The focus is on their role as state markers rather than data-bearing domain values.

When composed within other trait bounds (e.g. structs or domain aggregates), the selected variant may still govern or contextualize associated values, influencing behavior without itself being treated as a value-bearing domain object.

[FullCodec] and [TypeInfo] ensure the enum can be SCALE encoded/decoded and described in runtime metadata, while Debug supports diagnostics in both no_std and native builds.

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> RuntimeEnum for T
where T: FullCodec + TypeInfo + Debug,