| Crates.io | workspacer-syntax |
| lib.rs | workspacer-syntax |
| version | 0.5.2 |
| created_at | 2025-02-09 03:25:26.804285+00 |
| updated_at | 2025-07-13 00:15:36.586066+00 |
| description | Generate and rehydrate Rust code signatures from AST nodes, supporting functions, structs, enums, traits, type aliases, and macros. |
| homepage | |
| repository | https://github.com/klebs6/klebs-general |
| max_upload_size | |
| id | 1548624 |
| size | 193,902 |
The workspacer-syntax crate is a Rust library designed for parsing and generating signature strings for various abstract syntax tree (AST) nodes, such as functions, structs, enums, traits, type aliases, and macros. It facilitates both the creation of textual signatures and their rehydration from signature strings, thereby enabling syntactic reconstruction of Rust code components.
pub fn or pub struct.Add the following to your Cargo.toml:
[dependencies]
workspacer-syntax = "0.5.0"
Here is an example of generating a signature for a struct and retrieving its documentation:
use workspacer_syntax::{GenerateSignature, SignatureOptions};
use your_syntex_crate::ast;
let struct_ast: ast::Struct = /* Assume you have an AST node */;
let options = SignatureOptions::default();
let signature = struct_ast.generate_signature_with_opts(&options);
println!("Generated Signature:\n{}", signature);
This project is licensed under either the MIT or Apache-2.0 license at your option.