Mangle_ty! macro

Context: https://cybre.tech/SoniEx2/rust.eventbus/pulls/1 (some context was lost in the #rust-offtopic IRC channel, sorry)

It would be extremely helpful to have a mangle_ty! macro, so I could do something like:

enum Choices {
$(mangle_ty!($t),)+
}

let iters = [
$(
get_iter::<$t>().map(|(pri, hook)| (pri, Choices::mangle_ty!($t)(x))).peekable(),
)+
];

// ...

for (_pri, hook) in iters.something_here(): Iterator<Item=(i32, Choices)> {
match hook {
$(
Choices::mangle_ty!($t)(hook) => hook(event),
)+
}
}

This would make maintaining the post_event! macro a lot easier.

(What I want is completely doable in current Rust, it just involves a lot of deep nesting and I’m not sure if the compiler can handle it…)

I have a basic implementation of this as one of the examples in tt-call.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.