Attribute Macro ink_macro::scale_derive

source ·
#[scale_derive]
Expand description

Derive the re-exported traits ink::scale::Encode, ink::scale::Decode and ink::scale_info::TypeInfo. It enables using the built in derive macros for these traits without depending directly on the parity-scale-codec and scale-info crates.

§Options

  • Encode: derives ink::scale::Encode
  • Decode: derives ink::scale::Decode
  • TypeInfo: derives ink::scale_info::TypeInfo

§Examples

#[ink::scale_derive(Encode, Decode, TypeInfo)]
pub enum Error {}

This is a convenience macro that expands to include the additional crate attributes required for the path of the re-exported crates.

#[derive(::ink::scale::Encode, ::ink::scale::Decode)]
#[codec(crate = ::ink::scale)]
#[cfg_attr(
  feature = "std",
  derive(::scale_info::TypeInfo),
  scale_info(crate = ::ink::scale_info)
)]
pub enum Error {}