#generation #parser-generator #module #macro #znap #generate #ecosystem

znap-syn

Collection of utilities for parsing and code generation that power znap-macros

38 releases

0.1.37 Aug 31, 2024
0.1.36 Aug 29, 2024
0.1.31 Jul 26, 2024
0.1.19 Jun 29, 2024

#296 in Procedural macros

Download history 1180/week @ 2024-07-04 104/week @ 2024-07-11 8/week @ 2024-07-18 190/week @ 2024-07-25 431/week @ 2024-08-01 28/week @ 2024-08-08 20/week @ 2024-08-15 9/week @ 2024-08-22 314/week @ 2024-08-29 19/week @ 2024-09-05 68/week @ 2024-09-12 44/week @ 2024-09-19 56/week @ 2024-09-26 22/week @ 2024-10-03 6/week @ 2024-10-10 7/week @ 2024-10-17

108 downloads per month
Used in 7 crates (5 directly)

Apache-2.0

43KB
1K SLoC

znap-syn

Parsing and generating code for macros in Rust

The znap-syn module is a fundamental part of the znap library ecosystem, designed specifically for analyzing and generating code in Rust. This module is essential for the functionality of znap-macros, a collection of macros that depends on znap-syn for code generation and manipulation.

znap-syn allows you to transform Rust code fragments into manipulable objects, which can then be used to apply specific logic and generate new code.

Main components

  • CollectionMod: A CollectionMod is a structured representation of a Rust module. This object contains:

    • A list of ActionFn: functions that define actions within the module.
    • A name: the name of the module.
    • The module in its raw form: the normal structure of the module before being transformed.

In addition to the CollectionMod, znap-syn handles other object types such as ActionStruct, QueryStruct, and ErrorEnum. These are also derived from code snippets and used for various transformations and code generation.

Package

Package Description Version Docs
znap-syn Parsing and generating code for macros in Rust Crates.io Docs.rs

Dependencies

~3–13MB
~109K SLoC