123 Repositories
Rust proc-macro-derive Libraries
Rustato: A powerful, thread-safe global state management library for Rust applications, offering type-safe, reactive state handling with an easy-to-use macro-based API.
Rustato State Manager A generical thread-safe global state manager for Rust Introduction • Features • Installation • Usage • Advanced Usage • Api Refe
This library implements the flip-flop operator from Perl and Ruby as a Rust macro.
flip_flop.rs This library implements the flip-flop operator from Perl and Ruby as a Rust macro. Changelog April 1, 2024: Version 1.0.0. Usage The flip
Style terminal outputs in a minimal, macro-based, and dead simple way.
sty 🌈 $\mathbb{\color{red}{Style \ } \color{lightblue}{terminal}\ \color{black}{outputs \ }\color{gray}{\ in\ a} \color{magenta}{\ minimal}\color{gra
A procedural macro that copy-pastes match arms for new type variant enums.
All the same! If you ever had code that looks like this: use std::io; use std::pin::Pin; use std::task::{Context, Poll}; use tokio::io::AsyncWrite; us
Create Streamdeck Macros For Helldivers 2 Strategems!
Helldivers 2 Stratagem Macro Engine For Streamdeck This program contains macros for various stratagems to use. All macros are contained in the macro_e
Derive conversion traits when items are structurally similar.
structural-convert Derive conversion traits when items are structurally similar. Inspired by serde and struct-convert crates. Features One to one fiel
Just provide a macro for a certain programming language.
Trust me, this is safe! A macro wrap unsafe keyword into safe! macro. Always trust programmers. use std::alloc::{alloc, dealloc, Layout}; use trust_m
wait what? generate your entire infra from rust macros
infra as macro translate rust structs to terraform at compile time // your infra is a macro static DB: Postgres = Postgres16! { host: "env.host",
Rust macro to use a match-like syntax as a elegant alternative to nesting if-else statement
cond Rust macro to use a match-like syntax as an elegant alternative to many if-else statements. I got the idea from empty Go switch statements. I tho
Derive forms from structs.
leptos_form: Derive leptos forms from rust structs Documentation Docs GitHub repository Cargo package Minimum supported Rust version: 1.75.0 or later
A Rust macro for quickly unwrapping a refutable pattern.
unwrap_let! A Rust macro for quickly unwrapping a refutable pattern. Install Add unwrap_let to your dependency by running cargo add unwrap_let or edit
This library provides a convenient derive macro for the standard library's std::error::Error trait.
derive(Error) This library provides a convenient derive macro for the standard library's std::error::Error trait. [dependencies] therror = "1.0" Compi
A procedural macro to generate a new function implementation for your struct.
Impl New 🦀 A procedural macro to generate a new function implementation for your struct. 🚀 Add to your project Add this to your Cargo.toml: [depende
Derive with constructor for each field in struct.
A custom derive implementation for #[derive(with)] Get started 1.Generate with constructor for each field use derive_with::with; #[derive(with, Defau
todo2(a.k.a. todo or die) - A better todo! macro inspired from searls/todo_or_die
todo2 todo2(a.k.a. todo or die) - A better todo! macro inspired from searls/todo_or_die This crate provides a better todo! macro, which allows you to
Enhance Rust errors with file and line details using the `#[wherr]` macro for clearer debugging.
wherr Crate Discuss wherr on Hacker News Enhance Rust's ? operator by appending file and line number details to errors, simplifying the debugging proc
Macro to print variable(s) with values nicely (stripped from release builds)
log_macro Macro to print variable(s) with values nicely (stripped from release builds) Install cargo add log_macro Use Add this to top of file: #[mac
proc-macro to help with using surrealdb's custom functions
SurrealDB Functions This is a proc-macro crate that given a path to a .surql file or a folder of .surql files, will parse DEFINE FUNCTION fn::s inside
Attribute macro for implementing methods on both Foo and ArchivedFoo.
rkyv_impl Implement methods for Foo and ArchivedFoo in a single impl block. use rkyv::Archive; use rkyv_impl::*; use std::iter::Sum; #[derive(Archive
A HTML to node macro powered by rstml.
html-node A HTML to node macro powered by rstml. Features Text escaping Pretty-printing NEW: type-safe elements and attributes! (example) Example let
Proc-macros for generating icons from the Iconify API
iconify-rs This crate provides a macro to embed SVGs from Iconify. For a list of icons, see Iconify Icon Sets. 📝 Usage let svg = iconify::svg!("mdi:h
A macro to generate constructor to instanicate structs from JsValue using duck-typing.
ducktor ducktor is a Rust crate that allows you to create types from wasm_bindgen::JsValue using duck typing. With ducktor, you can define a struct th
derive(Code) simplifies error handling by providing an easy-to-use enumeration of error codes
enum-code Introduction enum-code is a derive macro for enum types. This library generates code that associates error codes with error types. It can be
Write simple proc-macros inline with other source code.
script-macro An experimental way to write simple proc-macros inline with other source code. Did you ever end up getting frustrated at the boilerplate
Rust Macros to automate the addition of Paths/Schemas to Utoipa crate, simulating Reflection during the compilation phase
utoipa_auto_discovery Rust Macros to automate the addition of Paths/Schemas to Utoipa crate, simulating Reflection during the compilation phase Crate
Compile-time lifetimes for comments.
todo_by Compile-time lifetimes for comments. To use this macro, add it to your dependencies via Cargo: cargo add todo_by Then, import and invoke the m
ChatGPT powered Rust proc macro that generates code at compile-time.
gpt-macro ChatGPT powered Rust proc macro that generates code at compile-time. Implemented Macros auto_impl!{} #[auto_test(...)] Usage Get ChatGPT API
Flexible deriving macro.
This library is a slightly more convenient version of derive for newtype pattern. = See also Deriving via Basic Usage #[derive(DerivingVia)] and then
A formatter for the leptos view! macro
leptosfmt A formatter for the leptos view! macro All notable changes are documented in: CHANGELOG.md Install cargo install leptosfmt or for trying out
Proc. macro to generate C-like `enum` tags.
Continuous Integration Documentation Crates.io #[derive(EnumTag)] This crate provides a proc. macro to derive the EnumTag trait for the given Rust enu
p5.js diagram within rustdoc
p5doc p5.js diagram within rustdoc Example This crate introduces a proc-macro #[p5doc::p5doc], which converts p5doc inline code in Markdown into a HTM
Derive `clone_from` for `Clone` in Rust
Derive Clone including clone_from This crate offers a derive macro called CloneFrom to derive Clone with a specialized clone_from implementation. When
Simple rust asset handling derive macro for enums, and a proc-macro learning resource!
asset-derive Summary • Todos • Docs Summary Simple Rust asset loading derive macro for Enums, and a resource for learning proc-macros! Please feel fre
Handy macro to generate C-FFI bindings to Rust for Haskell
hs-bindgen Handy macro to generate C-FFI bindings to Rust for Haskell. This library intended to work best in a project configured by cargo-cabal. N.B.
A convenient macro for building PathBufs in Rust.
pathbuf pathbuf is a simple crate which provides the pathbuf macro to conveniently construct the Rust PathBuf type. Example use pathbuf::pathbuf; use
Simple Rust derive-macro that simplifies integral enum creation
Integral enum A simple way to define integer-like enums. This macro implements bunch of traits that are usually implemented via looooong derive(..) at
A micro crate that simplifies a bit the use of the std macro thread_local!.
with-thread-local A micro crate that simplifies a bit the use of the std macro thread_local!. extern crate regex; use with_thread_local::with_thread_
Library and proc macro to analyze memory usage of data structures in rust.
Allocative: memory profiler for Rust This crate implements a lightweight memory profiler which allows object traversal and memory size introspection.
Procedural macro to derive Serde serializer-deserializer for Prost
prost-serde-derive prost-serde-derive is a procedural macro to generate Serde serializers and deserializers for Prost-generated structs. Rationale Cur
Macro to customize the behavior of `?`
::custom-try Macro to customize the behavior of ? Examples use ::custom_try::custom_try; #[repr(transparent)] pub struct FfiResult { pub status_c
An attribute macro to simplify writing simple command line applications.
fncli An attribute macro to simplify writing simple command line applications. Example #[fncli::cli] fn main(a: i32, b: i32) { println!("{}", a +
Derive AsyncRead and AsyncWrite.
derive-tokio-io Derive AsyncRead and AsyncWrite. Usage If the struct has only one field, AsyncRead and AsyncWrite are derived for that field. use deri
A proc macro for creating compile-time checked CSS class sets, in the style of classNames
semester Semester is a declarative CSS conditional class name joiner, in the style of React's classnames. It's intended for use in web frameworks (lik
hashmap macro for creating hashmap from provided key/value pairs
HashMap Macro Creates a HashMap from provided key/value pairs. Usage use std::collections::HashMap; use hashmap_macro::hashmap; let m: HashMap&str,
A rust proc-macro which allows for reading and writing to remote objects through a generated enum
Remote-Obj A rust proc-macro which allows for reading and writing fields/variants of (possibly nested) remote objects by generating a single enum whic
Custom formatting for Rust.
custom-format This crate extends the standard formatting syntax with custom format specifiers, by providing custom formatting macros. It uses : (a spa
Macro for fast implementing serialize methods in serde::Serializer trait
impl_serialize! This library provides a simple procedural macro for fast implementing serialize methods in serde::Serializer trait. [dependencies] imp
Proc macro implementation of #[naked]
#[naked] Documentation This crate provide a proc macro version of the #[naked] attribute which can be used on stable Rust. Example // The SYSV64 calli
Croc-look is a tool to make testing and debuging proc macros easier
croc-look croc-look is a tool to make testing and debuging proc macros easier by these two features Printing the implementation specific generated cod
A simple /proc/pid/{mem,maps} library for Rust
Summary A very simple library that wraps around /proc/pid/mem and /proc/pid/maps to read memory out of a running process on Linux. Usage Basic usage l
An html macro for dioxus applications.
dioxus html macro This crate offers an html! like macro for dioxus applications. It expands to the equivalent rsx! macro call you would have made othe
A Rust crate to expressively declare bitfield-like structs
proc-bitfield A Rust crate to expressively declare bitfield-like structs, automatically ensuring their correctness at compile time and declaring acces
A Rust attribute macro that adds memoization to a function (rhymes with Mickey)
michie (sounds like Mickey) — an attribute macro that adds memoization to a function. Table of contents Features Non-features key_expr key_type store_
Rust derive-based argument parsing optimized for code size
Argh Argh is an opinionated Derive-based argument parser optimized for code size Derive-based argument parsing optimized for code size and conformance
Macros to make writing proc-macro crates easy
proc-easy Macros to make writing proc-macro crates easy. This crate provides mainly macros and supporting types and traits to reduce amount of boilerp
A convenient on-screen message print macro for bevy.
Bevy Debug Text Overlay A proof of concept for adding a very convenient text overlay macro to the bevy game engine. This is derived from the code I us
Plugin for macro-, mini-quad (quads) to save data in simple local storage using Web Storage API in WASM and local file on a native platforms.
quad-storage This is the crate to save data in persistent local storage in miniquad/macroquad environment. In WASM the data persists even if tab or br
Provide expansion of proc-macros, in a way that rustc directs you directly to the issues at hand
expander Expands a proc-macro into a file, and uses a include! directive in place. Advantages Only expands a particular proc-macro, not all of them. I
Make data-driven table rendering easy with Dioxus
Dioxus Table Make data-driven table rendering easy with Dioxus Installation Until the next release of Dioxus this requires Dioxus nightly from git. Th
Lightweight parsing for Rust proc macros
Lightweight parsing for Rust proc macros Venial is a WIP parser for Rust proc macros. When writing proc macros that need to parse Rust code (such as a
Derive macro implementing 'From' for structs
derive-from-ext A derive macro that auto implements 'std::convert::From' for structs. The default behaviour is to create an instance of the structure
This library implements a type macro for a zero-sized type that is Serde deserializable only from one specific value.
Monostate This library implements a type macro for a zero-sized type that is Serde deserializable only from one specific value. [dependencies] monosta
Semantic find-and-replace using tree-sitter-based macro expansion
Semantic find-and-replace using tree-sitter-based macro expansion
A simple cross-process locking API
A simple cross-process locking API
Rust library to scan files and expand multi-file crates source code as a single tree
syn-file-expand This library allows you to load full source code of multi-file crates into a single syn::File. Features: Based on syn crate. Handling
Derive macro for encoding/decoding instructions and operands as bytecode
bytecoding Derive macro for encoding and decoding instructions and operands as bytecode. Documentation License Licensed under either of Apache License
Isn't it time to be a bit nicer to rustc?
politeness-macro Aren't we all too rude to computers? Isn't it time to bring a bit more politeness into our programming? Shouldn't we be a bit nicer t
No-nonsense input!(...) macro for Rust
No-nonsense input!(...) macro for Rust
Compile-time checked Builder pattern derive macro with zero-memory overhead
Compile-time checked Builder pattern derive macro with zero-memory overhead This is very much a work-in-progress. PRs welcome to bring this to product
lispr is a Rust macro that tries to implement a small subset of LISPs syntax in Rust
lispr lispr is a Rust macro that tries to implement a small subset of LISPs syntax in Rust. It is neither especially beautiful or efficient since it i
Example of using nom parsers from a proc macro
Example of using nom parsers from a proc macro This project is organised as 3 crates: nom_macro is the main project, exposing the proc macro and the g
A procedural macro for defining nom combinators in simple DSL
A procedural macro for defining nom combinators in simple DSL
A procedural macro for configuring constant values across crates
toml-cfg Rough ideas: Crates can declare variables that can be overridden Anything const, e.g. usize, strings, etc. (Only) The "root crate" can overri
The [cain!] macro is a macro that rewrites sequential Rust branch statements into nested branches
Note! This crate is experimental and under development. It may include bugs that alter the behavior of your code in unexpected ways. You should review
Macro assembler for Rust
Macro Assembler This crate implement JSC/SpiderMonkey like macro assembler. Macro assembler purpose is to generate machine code for different platform
A Rust proc-macro crate which derives functions to compile and parse back enums and structs to and from a bytecode representation
Bytecode A simple way to derive bytecode for you Enums and Structs. What is this This is a crate that provides a proc macro which will derive bytecode
Attribute for defining `macro_rules!` macros with proper visibility and scoping
macro-vis This crate provides an attribute for defining macro_rules! macros that have proper visibility and scoping. The default scoping and publicity
Learn to write Rust procedural macros [Rust Latam conference, Montevideo Uruguay, March 2019]
Rust Latam: procedural macros workshop This repo contains a selection of projects designed to learn to write Rust procedural macros — Rust code that g
proc macros for generating mut and non-mut methods without duplicating code
mwt Hey! You! Read this before using! mwt was thrown together pretty quickly for personal use, because I couldn't find an existing crate that does thi
Rust macro that uses GPT3 codex to generate code at compiletime
gpt3_macro Rust macro that uses GPT3 codex to generate code at compiletime. Just describe what you want the function to do and (optionally) define a f
Schema2000 is a tool that parses exsiting JSON documents and tries to derive a JSON schema from these documents.
Schema 2000 Schema2000 is a tool that parses exsiting JSON documents and tries to derive a JSON schema from these documents. Currently, Schema2000 is
Quick'n dirty macro set for advent of code 2021
AOC quick'n dirty macro set Those are implemented using quick'n dirty procedural macros and libraries. Running the program Use cargo run --release --
Rust macro to make recursive function run on the heap (i.e. no stack overflow).
Decurse Example #[decurse::decurse] // 👈 Slap this on your recursive function and stop worrying about stack overflow! fn factorial(x: u32) - u32 {
Rust I18n is use Rust codegen for load YAML file storage translations on compile time, and give you a t! macro for simply get translation texts.
Rust I18n Rust I18n is use Rust codegen for load YAML file storage translations on compile time, and give you a t! macro for simply get translation te
A proc-macro to get Vecu8 from struct and vise versa
byteme A proc-macro to convert a struct into Vec and back by implemeting From trait on the struct. The conversion is Big Endian by default. We have ma
Yet another geter/setter derive macro.
Gusket Gusket is a getter/setter derive macro. Comparison with getset: gusket only exposes one derive macro. No need to derive(Getters, MutGetters, Se
Example of structuring a proc macro crate for testability
testing-proc-macros Example of structuring a proc macro crate for testability. See accompanying blog post for details. License Licensed under either o
Command line interface as a function.
Command line interface as a function. fncmd fncmd is an opinionated command line parser frontend that wraps around clap. The functionality is mostly i
A stupid macro that compiles and executes Rust and spits the output directly into your Rust code
inline-rust This is a stupid macro inspired by inline-python that compiles and executes Rust and spits the output directly into your Rust code. There
A Rust attribute macro to limit a function's number of runs over a specified period of time
throttle_my_fn: A Rust attribute macro to throttle the execution of functions throttle_my_fn is a Rust attribute macro to limit a function's number of
✨ Safe, global singletons initialized at program start
✨ magic_static Safe, global singletons initialized at program start. Usage Simply add magic_static as a dependency in your Cargo.toml to get started:
Rust crate that provides a convenient macro to quickly plot variables.
Debug Plotter This crate provides a convenient macro to quickly plot variables. Documentation For more information on how to use this crate, please ta
Common processing blocks used with your Runes.
Common Processing Blocks (API Docs) Processing blocks built by Hammer of the Gods that you can use with your Runes. License This project is licensed u
Procedural macros for Floccus
floccus-proc Procedural macros for floccus This crate contains procedural attribute macros (currently only one) used by the floccus. But potentially c
secmem-proc is a crate designed to harden a process against low-privileged attackers running on the same system trying to obtain secret memory contents of the current process.
secmem-proc is a crate designed to harden a process against low-privileged attackers running on the same system trying to obtain secret memory contents of the current process. More specifically, the crate disables core dumps and tries to disable tracing on unix-like OSes.
assay - A super powered testing macro for Rust
assay - A super powered testing macro for Rust as·say /ˈaˌsā,aˈsā/ noun - the testing of a metal or ore to determine its ingredients and quality. Rust
Compute and derive metrics by watching a log file
Export Prometheus metrics from your web server's access log Web servers only offer limited metrics. For example, nginx only offers stub_status unless
Macro for stating unsafe assumptions in Rust.
assume A macro for stating unsafe assumptions in Rust. Using this macro, one can supply assumptions to the compiler for use in optimization. These ass
Rust derive macros for automating the boring stuff.
derived: Macros for automating the boring stuff The derived crate provides macros that can simplify all the boring stuff, like writing constructors fo
Attribute macro that generates negated versions of`is_something` functions
negate negate is a simple attribute macro that negates a given function. Usage #[negate] Given a function of the form is_* that returns a boolean valu