102 Repositories
Rust macro-vis 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
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
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
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
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
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 +
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
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_
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
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
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
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
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
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
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
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
This crate defines a single macro that is a brainfunct compile-time interpreter.
Compile Protection This crate defines a single macro that is a brainfunct compile-time interpreter. One example is as follows #![recursion_limit = "18
A fully-featured lexer generator, implement as a proc macro
lexgen: A fully-featured lexer generator, implemented as a proc macro lexer! { // First line specifies name of the lexer and the token type return
atttribute macro for running a flaky test multiple times
flaky_test This attribute macro will register and run a test 3 times, erroring only if all three times fail. Useful for situations when a test is flak
Obake is a procedural macro for declaring and maintaining versioned data-structures.
Obake is a procedural macro for declaring and maintaining versioned data-structures. The name 'obake' is taken from the Japanese 'お化け (おばけ)', a class of supernatural beings in Japanese folklore that shapeshift.
zero runtime cost default arguments in rust
Default Arguments in Rust Enables default arguments in rust by macro in zero cost. Just wrap function with default_args! and macro with name of functi
The nightly_crimes!{} macro commits horrible crimes to allow you to enable nightly features on the stable compiler.
The nightly_crimes!{} macro commits horrible crimes to allow you to enable nightly features on the stable compiler.
This crate provides a convenient macro that allows you to generate type wrappers that promise to always uphold arbitrary invariants that you specified.
prae This crate provides a convenient macro that allows you to generate type wrappers that promise to always uphold arbitrary invariants that you spec
concat-arrays: a rust macro for concatenating fixed-size arrays
concat-arrays: a rust macro for concatenating fixed-size arrays This crate defines concat_arrays!, a macro that allows you to concatenate arrays.
A copypastable guide to implementing simple derive macros in Rust.
A copypastable guide to implementing simple derive macros in Rust. The goal Let's say we have a trait with a getter trait MyTrait {
Parsing and inspecting Rust literals (particularly useful for proc macros)
litrs: parsing and inspecting Rust literals litrs offers functionality to parse Rust literals, i.e. tokens in the Rust programming language that repre
A Rust macro for writing nested loop expressions
loop_chain A Rust macro for writing nested loop expressions Usage | Examples | Docs Dependencies [dependencies] loop_chain = "0.1.1" Usage For express
An LR parser generator, implemented as a proc macro
parsegen parsegen is an LR parser generator, similar to happy, ocamlyacc, and lalrpop. It currently generates canonical LR(1) parsers, but LALR(1) and
A Rust macro for writing regex pattern matching.
regexm A Rust macro for writing regex pattern matching.
proc-macro for accessing struct field names at runtime
field_names field_names is a Rust crate to expose a field or variant names from source code as strings at runtime. Example Consider a simple struct su
Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.
Rust Embed Rust Custom Derive Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev. Y
A macro-based html builder for rust
Horrorshow A macro-based html templating library, compatible with stable rust (currently requires rust = 1.37). Features This crate will degrade grac
:pencil: Compile-time HTML templates for Rust
maud Documentation (source) • API reference • Change log Maud is an HTML template engine for Rust. It's implemented as a macro, html!, which compiles
hado-rshado — A little macro for writing haskell-like do expressions without too much ceremony
hado Monadic haskell-like expressions brought to rust via the hado! macro What? A little macro for writing haskell-like do expressions without too muc