alias_macros

Crates.ioalias_macros
lib.rsalias_macros
version0.1.1
created_at2025-07-21 17:49:36.302314+00
updated_at2025-07-21 18:02:40.689537+00
descriptionA alias macro for Rust - create alias for everything...!
homepagehttps://github.com/shubhiscoding/alias_macros
repositoryhttps://github.com/shubhiscoding/alias_macros
max_upload_size
id1762355
size5,413
Shubh Kesharwani (shubhiscoding)

documentation

https://github.com/shubhiscoding/alias_macros/blob/main/README.md

README

Define Macro Implementation

This directory contains the procedural macro implementation for the alias_macros crate.

About Alias Macros

alias_macros is a Rust procedural macro crate that allows you to create custom aliases for types, keywords, and complex syntax patterns. Create TypeScript-like interfaces, alias primitive types with descriptive names, or build domain-specific syntax - all with zero runtime cost!

📚 For complete usage examples, features, and documentation, see the main README.

Structure

  • src/lib.rs - Contains the define! procedural macro implementation
  • Cargo.toml - Crate configuration with proc-macro dependencies

Implementation Details

The define! macro:

  1. Parses input in the format alias = replacement
  2. Creates a macro_rules! macro with the alias name
  3. Supports two patterns:
    • () - Expands to just the replacement
    • ($($tokens:tt)*) - Expands to replacement followed by the tokens

Dependencies

  • syn - For parsing Rust syntax
  • quote - For generating Rust code
  • proc_macro2 - For token stream manipulation

Building

cargo build

This crate is used as a dependency by the main project and provides the define! macro functionality.

Commit count: 0

cargo fmt