desugar-impl 0.1.1

Sugar for less explicit generics in structs, enums, and union declarations.
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 2 items with examples
  • Size
  • Source code size: 22.15 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 283.47 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Kijewski-crates-graveyard
desugar-impl-0.1.1 has been yanked.

impl Trait not allowed outside of function and method return types

… but it is now!

This library gives you one macro, and one macro only: #[desugar_impl].

Annotate any struct, enum, or union with #[desugar_impl] to allow the use of field_name: impl SomeTrait in their declaration. E.g.

#[desugar_impl]
struct Test {
    a: impl Clone + PartialOrd,
    b: impl Clone + PartialOrd,
    c: impl Hash,
}

desugars to

struct Test<Ty1, Ty2, Ty3>
where
    Ty1: Clone + PartialOrd,
    Ty2: Clone + PartialOrd,
    Ty3: Hash,
{
    a: Ty1,
    b: Ty2,
    c: Ty3,
}

You can still place any #[derive(…)] macros just below #[desugar_impl] any they see work with the desugared code.