11 releases (4 breaking)

0.4.3 Apr 2, 2024
0.4.2 Mar 26, 2024
0.3.1 Apr 2, 2024
0.3.0 Mar 20, 2024
0.0.1 Nov 10, 2023

#421 in Rust patterns

Download history 13/week @ 2023-12-29 81/week @ 2024-01-05 106/week @ 2024-01-12 268/week @ 2024-01-19 426/week @ 2024-01-26 491/week @ 2024-02-02 732/week @ 2024-02-09 731/week @ 2024-02-16 907/week @ 2024-02-23 1890/week @ 2024-03-01 2192/week @ 2024-03-08 1980/week @ 2024-03-15 1958/week @ 2024-03-22 2008/week @ 2024-03-29 3149/week @ 2024-04-05

9,429 downloads per month
Used in 17 crates (3 directly)

Apache-2.0

175KB
4K 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

~4.5MB
~98K SLoC