Trait polkadot_primitives::v8::EncodeAs
source · pub trait EncodeAs<T> {
// Required method
fn encode_as(&self) -> Vec<u8> ⓘ;
}
Expand description
This helper trait ensures that we can encode Statement
as CompactStatement
,
and anything as itself.
This resembles codec::EncodeLike
, but it’s distinct:
EncodeLike
is a marker trait which asserts at the typesystem level that
one type’s encoding is a valid encoding for another type. It doesn’t
perform any type conversion when encoding.
This trait, on the other hand, provides a method which can be used to simultaneously convert and encode one type as another.