Crates.io | rustalize |
lib.rs | rustalize |
version | 0.1.0 |
source | src |
created_at | 2024-10-13 21:07:40.234912 |
updated_at | 2024-10-13 21:07:40.234912 |
description | Rustalizer is a powerful tool designed to help developers analyze complex Rust code structures. It provides a simple Abstract Syntax Tree (AST) parser that can break down Rust traits, structs, and enums into a more manageable and visually comprehensible format. |
homepage | |
repository | |
max_upload_size | |
id | 1407682 |
size | 28,517 |
Rustalizer is a powerful tool designed to help developers analyze complex Rust code structures. It provides a simple Abstract Syntax Tree (AST) parser that can break down Rust traits, structs, and enums into a more manageable and visually comprehensible format.
Understanding complex code structures can be challenging, especially in large projects. Rustalizer aims to simplify this process by providing a clear, hierarchical view of your Rust code's structure. This can be particularly useful for:
To use Rustalizer in your Rust project, add it as a dependency in your Cargo.toml
:
[dependencies]
rustalizer = { git = "https://github.com/vschwaberow/rustalizer.git" }
Then, you can use the rustalizer
crate in your Rust code. Here's an example of how to parse and display a Rust trait using Rustalizer:
use rustalizer::AstNode;
use std::str::FromStr;
fn main() {
let complex_struct = r#"
pub struct ComplexStruct<T, U> {
data: Vec<T>,
processor: Box<dyn Fn(T) -> U>,
metadata: Option<String>,
}
"#;
match AstNode::from_str(complex_struct) {
Ok(ast) => {
println!("Analyzed structure:");
ast.display_tree();
}
Err(e) => println!("Error analyzing structure: {}", e),
}
}
This example demonstrates how to parse a complex Rust structure and display its AST. You can extend this example to handle other types of Rust code structures as well.
We welcome contributions to Rustalizer! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on our GitHub repository.
This project is licensed under the MIT License. See the LICENSE
file for more details.