easy_ebml!() { /* proc-macro */ }
Expand description

Macro that makes writing an EBML spec easy.

This provides an even easier alternative to create implementations of the EbmlSpecification and EbmlTag traits than using the [#ebml_specification] attribute. As a bonus, your spec will be more legible and maintainable!

As an example, compare the following equivalent definitions:

#[ebml_specification]
#[derive(Clone)]
enum Example {
  #[id(0x01)]
  #[data_type(Master)]
  Root,

  #[id(0x02)]
  #[data_type(Master)]
  #[doc_path(Root)]
  Parent,

  #[id(0x100)]
  #[data_type(UnsignedInt)]
  #[doc_path(Root/Parent)]
  Data,
}

vs

easy_ebml! {
  #[derive(Clone)]
  enum Example {
    Root                : Master = 0x01,
    Root/Parent         : Master = 0x02,
    Root/Parent/Data    : UnsignedInt = 0x100,
  }
}

Behind the scenes easy_ebml! still uses the existing [#ebml_specification] attribute macro, so the final output of this macro will remain identical.