You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For my use case I need byte slices composed mostly of ASCII with some arbitrary bytes thrown in as escapes. I hoped I could do something like this:
const data:&[u8] = formatcp!(b"Here is a 'string' with invalid UTF8 {INVALID_UNICODE} in it.", INVALID_UNICODE=[0xa0, 0xa1]);
To do this with const_format, I'd need a version of formatcp! that returns a byte slice literal, rather than a &str.
Feel free to close if creating &[u8] rather than &str is out of scope for these crates. As a workaround I'll use a slice concatenation crate, more like concat_bytes!(b"Here is a 'string' with invalid UTF8 ", INVALID_UNICODE, " in it.").
The text was updated successfully, but these errors were encountered:
For my use case I need byte slices composed mostly of ASCII with some arbitrary bytes thrown in as escapes. I hoped I could do something like this:
To do this with
const_format
, I'd need a version offormatcp!
that returns a byte slice literal, rather than a&str
.Feel free to close if creating
&[u8]
rather than&str
is out of scope for these crates. As a workaround I'll use a slice concatenation crate, more likeconcat_bytes!(b"Here is a 'string' with invalid UTF8 ", INVALID_UNICODE, " in it.")
.The text was updated successfully, but these errors were encountered: