News for hackers. Stuff that matters.
Re:Fast Math Rendering on the Web by anderskaseorg on Sunday April 12, 2020 @07:06AM (#22847392)
Obviously you should use whatever language you want on your projects, but in case you’re interested:

> unfortunately, asking rust to treat UTF-8 string as a "ball of bytes" is hard, when it's stupidly easy with C.

String::as_bytes seems pretty easy, and there are byte literals b'?' of type u8 and b"???" of type [u8]. You can avoid interacting with the UTF-8 types at all if you don’t want to.

> Plus, I wanted to use arena-style-allocation where I make huge allocations in one go and then don't think about memory, something that I don't have control over in Rust.

Perhaps the bumpalo and typed-arena crates would interest you.

https://docs.rs/bumpalo/ https://docs.rs/typed-arena/

Re:Fast Math Rendering on the Web by kevincox on Sunday April 12, 2020 @08:05AM (#22847668)
Unfortunately `&[u8]` is missing a lot of convenience methods that are on `&str`. It is getting better over time but I have definitely encounter the problem before where I tried to switch some string-based code to byte-based and was disappointed by the missing functionality.
Re:Fast Math Rendering on the Web by llogiq on Monday April 13, 2020 @04:34AM (#22854110)
Then perhaps the bstr crate (https://docs.rs/bstr/0.2.12/bstr) might be what you want.