dtolnay / seq-macro

Macro to repeat sequentially indexed copies of a fragment of code
Apache License 2.0
137 stars 5 forks source link

Infix pasting #14

Closed bradleyharden closed 2 years ago

bradleyharden commented 2 years ago

I don't think this is actually a solvable issue, but I just wanted to confirm that I'm not missing something.

I want to create a series of sequential identifiers with both a prefix and a suffix, e.g. PrefixNSuffix. As far as I can tell, I can't do this using seq! alone; I also need to use paste!. Is that correct?

I'm using something like

seq!(N in 0..11 {
    paste! {
        pub enum [<Prefix N Suffix>] {};
    }
});

In general, I find that I combine seq! and paste! quite frequently. Is there perhaps some convenient way to combine them? Or would you prefer to keep the functionality distinct?

dtolnay commented 2 years ago

Yeah paste is good for this. I don't feel inclined to reimplement either macro inside the other.