18 releases (11 breaking)

new 0.11.0 Mar 5, 2025
0.10.0 Nov 15, 2024
0.9.0 Oct 22, 2024
0.8.0 May 27, 2024
0.0.1 Nov 10, 2023

#197 in Rust patterns

Download history 38262/week @ 2024-11-19 38282/week @ 2024-11-26 37915/week @ 2024-12-03 37149/week @ 2024-12-10 30426/week @ 2024-12-17 10050/week @ 2024-12-24 19568/week @ 2024-12-31 33939/week @ 2025-01-07 51569/week @ 2025-01-14 41270/week @ 2025-01-21 36903/week @ 2025-01-28 41550/week @ 2025-02-04 47026/week @ 2025-02-11 42132/week @ 2025-02-18 38412/week @ 2025-02-25 35514/week @ 2025-03-04

170,630 downloads per month
Used in 59 crates (3 directly)

Apache-2.0

205KB
4.5K SLoC

scale-typegen

A library based on scale-info to transpile portable registries of types into rust type definitions. This library exposes a TypeGenerator struct which wants to be given two things:

  • a scale_info::PortableRegistry containing the type information for the types that will be transpiled.
  • a TypeGeneratorSettings defining how the code generation happens: What derives and attributes that are applied, substitutes for types, if docs should be generated as well, (..).

It exposes a generate_types_mod() function that creates an intermediate representation of a module (ModuleIR) that contains types and other modules. It can be directly converted to rust code via to_token_stream().


lib.rs:

A library based on scale-info to transpile portable registries of types into rust type definitions.

Dependencies

~5MB
~111K SLoC