12 releases (5 breaking)

0.5.0 Apr 29, 2024
0.4.2 Mar 26, 2024
0.3.1 Apr 2, 2024
0.1.0 Dec 8, 2023
0.0.1 Nov 10, 2023

#412 in Rust patterns

Download history 189/week @ 2024-01-18 450/week @ 2024-01-25 459/week @ 2024-02-01 765/week @ 2024-02-08 720/week @ 2024-02-15 764/week @ 2024-02-22 1760/week @ 2024-02-29 2201/week @ 2024-03-07 1871/week @ 2024-03-14 2152/week @ 2024-03-21 1922/week @ 2024-03-28 2873/week @ 2024-04-04 3296/week @ 2024-04-11 2472/week @ 2024-04-18 3051/week @ 2024-04-25 1899/week @ 2024-05-02

11,581 downloads per month
Used in 21 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

~4MB
~82K SLoC