Is there a `to_str_radix` function for Rust?
05:45 20 Mar 2026

I'm trying to display a binary number as a string like so:

let string = b.to_str_radix(2);

But I cannot find a to_str_radix function in std. Searching in the Rust Standard Library gives zero results. However, there exists a from_str_radix function.

Is there a way to do this and why isn't this implemented?

rust binary integer