Rust has a stringify!
macro to get an expression as a string.
Is there a way to get the equivalent functionality that outputs bytes instead?
As if the expression were written as a byte string literal, eg: b"some text"
.
The reason to use a macro instead of str.as_bytes()
is that conversion functions cant be used to construct const
values.
See: How to construct const integers from literal byte expressions?
for why you might want to use this macro.