#tuple #proc-macro #array-like

macro no-std fast_tuple

This is a Rust procedural macro library that provides an easy way to construct and annotate tuples

4 releases

0.1.3 Dec 22, 2019
0.1.2 Dec 18, 2019
0.1.1 Dec 16, 2019
0.1.0 Dec 16, 2019

#327 in No standard library

Unlicense

5KB

This procedural macro crate provides a way to construct and annotate tuple types like arrays in Rust.

Usage

!#[feature(proc_macro_hygiene)] // required for expansion to expressions

use fast_tuple::tuple;

fn main() {
    let tuple: tuple!(u32; 2) = tuple!(2; 2);
    println!("{}, {}", tuple.0, tuple.1); // prints 2, 2
}

Version

This is a nigthly-only crate at the moment, unless you only use it for annotate types,this macro is also no_std only when debug assertions are disabled.


lib.rs:

This procedural macro crate serves the purporse of construct a tuple thought the array-like [T; N] syntax,where T can be a type for annotate or an expression and N is the number of times T repeats.

This macro is no_std with debug assertions disabled.

No runtime deps