5 ms·
Surely, you can use Rust's enums for this.
by ogogmad 4y ago
Surely, you can use Rust's enums for this.
- burntsushi 4y agoAs I said above, I'm the author of Rust's regex crate. I know what Rust enums are. Still doesn't change what I said.
- ogogmad 4y agoI mean that it's typesafe.
- burntsushi 4y agoI still don't know what you're talking about. I didn't say anything about type safety? Nobody else did? I guess you're probably talking about a combinator API... Like this one: https://docs.rs/regex-syntax/latest/regex_syntax/hir/struct.Hir.html https://docs.rs/regex-syntax/latest/regex_syntax/hir/struct.... My original comment was talking about adding variables to the regex language itself. String interpolation and combinator APIs and enums and type safety are all beside the point. They surely solve a similar problem as regex variables in certain contexts, but they go about it in a very different way and are specific to the context in which the regex is created.