super-seq-macro

Crates.iosuper-seq-macro
lib.rssuper-seq-macro
version0.3.8
created_at2025-02-03 22:22:10.815501+00
updated_at2025-02-10 21:57:23.273914+00
descriptionMacro to repeat a fragment of code based on a RHAI expression
homepage
repositoryhttps://github.com/ervanalb/seq-macro
max_upload_size
id1541159
size54,831
Eric Van Albert (ervanalb)

documentation

https://docs.rs/super-seq-macro

README

Supercharged seq! macro

github crates.io docs.rs


This crate provides a seq! macro to repeat a fragment of source code and substitute into each repetition a value of your choosing, drawn from an iterable RHAI expression.

This is a fork of the seq-macro crate and is backwards-compatible for simple usage.

use super_seq_macro::seq;

seq!(A in 0..3 {#(
    const WITHOUT_~A: [u32; 2] = seq!(B in (0..3).collect().filter(|x| x != A) {
        [ #( B, )* ]
    });
)*});

assert_eq!(WITHOUT_0, [1, 2]);
assert_eq!(WITHOUT_1, [0, 2]);
assert_eq!(WITHOUT_2, [0, 1]);

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 0

cargo fmt