the.bay.news

As_str for integers

The Rust Programming Language Forum
As_str for integers
I'm looking for ways to have str representations of ranges of integers without allocating. My current best attempt is to manually match on each value: match i { 0 => "0", 1 => "1", 2 => "2", ... n => "n" } which works, but has the obvious problem of not scaling. I've tried to automate this with macros, but i couldn't get it to work with declarative macros and procedural macros seemed too involved for me.

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.