Derive Macro scale_encode::EncodeAsType 
source · #[derive(EncodeAsType)]
{
    // Attributes available to this derive:
    #[encode_as_type]
}
Expand description
The EncodeAsType derive macro can be used to implement EncodeAsType
on structs and enums whose fields all implement EncodeAsType.
Example
use scale_encode as alt_path;
use scale_encode::EncodeAsType;
#[derive(EncodeAsType)]
#[encode_as_type(trait_bounds = "", crate_path = "alt_path")]
struct Foo<T> {
   a: u64,
   b: bool,
   c: std::marker::PhantomData<T>
}Attributes
- #[encode_as_type(crate_path = "::path::to::scale_encode")]: By default, the macro expects- scale_encodeto be a top level dependency, available as- ::scale_encode. If this is not the case, you can provide the crate path here.
- #[encode_as_type(trait_bounds = "T: Foo, U::Input: EncodeAsType")]: By default, for each generate type parameter, the macro will add trait bounds such that these type parameters must implement- EncodeAsTypetoo. You can override this behaviour and provide your own trait bounds instead using this option.
Limitations
The generated EncodeAsType impls currently support a maximum of 32 fields in the
struct or variant; if you exceed this number you’ll hit a compile error.