pub trait Categorize<X>where
X: CustomValueKind,{
// Required method
fn value_kind() -> ValueKind<X>;
}
Expand description
The Categorize
trait marks a rust type as having a fixed value kind for SBOR encoding/decoding.
Most rust types will have a fixed value kind in the SBOR model, and so can implement Categorize
,
but some (such as the SBOR Value
) do not.
Implementing Categorize
is required for being able to directly Encode
/ Decode
any
collection containing the rust type - because the value kind is lifted/deduplicated in the encoded payload.
If a type cannot implement Categorize
, as a work-around, you can put it into a collection by (eg)
wrapping it in a tuple of size 1.
Required Methods§
fn value_kind() -> ValueKind<X>
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.