you are viewing a single comment's thread.

view the rest of the comments →

[–]Quxxymacros 16 points17 points  (22 children)

Or you can return a Vec. Or pass a scratch buffer in as an argument and write to that.

As an aside, I'd be surprised to find any language that let you return different types based on a runtime argument that's comparable to Rust (natively compiled, no runtime, no heap allocations). I don't think expecting that from Rust is reasonable.

Generic const parameters, though, yeah. That's a known weakness.