Toolkit for building Rust procedural macros with automatic error context generation and powerful utility macros.
For detailed feature documentation, usage examples, and API reference, please visit:
- crates.io/crates/easy-macros - Short version
- docs.rs/easy-macros - Complete API documentation and usage guides
Easy Macros provides:
- Automatic Error Context - Works in any Rust project, automatically adds
.with_context()to all?operators - Attribute Pattern Matching - Extract and validate attributes using intuitive patterns
- Exhaustive AST Traversal - Generate recursive handlers for all
syntypes - Helper Utilities - Token stream builders, parsing helpers, crate finding, and more
- Result Type for Proc Macros - Use
anyhow::Result<TokenStream>with automatic error conversion
This repository is organized as a Cargo workspace containing multiple crates:
-main-crate/- The maineasy-macroscrate (re-exports all functionality)all-syntax-cases/- Exhaustive AST traversal macroalways-context/- Automatic error context generationattributes/- Attribute pattern matching utilitiesanyhow-result/- Result type wrapper for proc macroshelpers/- Helper utilities for proc macro development- Supporting crates - Internal implementations and build tools
Contributions are welcome! Here's how you can help:
If you find a bug or have a feature request:
- Check the issue tracker to see if it's already reported (you can upvote existing issues to increase priority)
- If not, open a new issue with:
- A clear description of the problem or feature
- Steps to reproduce (for bugs)
- Expected vs. actual behavior
- Relevant code snippets or error messages
- Fork the repository and create a new branch for your changes
- Make your changes following the existing code style
- Test your changes thoroughly
- Update documentation if you're adding new features or changing APIs
- Run the preparation script:
./scripts/pr.sh- To perform all necessary checks and generation before submitting a PR - Commit with clear, descriptive messages
- Submit a pull request with:
- A clear description of what you've changed and why
- Reference to any related issues
- Examples of the new functionality (if applicable)
- Follow standard Rust conventions and idioms
- Use
cargo fmtto format your code - Run
cargo clippyand address any warnings - Add doc comments for public APIs
- Include tests for new functionality
This project is licensed under the Apache License, Version 2.0.
You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
See the LICENSE file for the full license text.