See the Documentation.
Pairs well with the colored crate.
use to_string::*;
assert_eq!("0b1111000", 120.to_bin());
assert_eq!("0xcafe", 51966.to_hexa());
assert_eq!("0xdeadbeef", (-559038737).to_hexa());
assert_eq!("0o1747", 999.to_octal_string());
assert_eq!("4.21e1", (42.1).to_exp());
Provided methods:
- to_bin() / to_binary_string()
- to_hexa() / to_hexa_string()
- to_octal() / to_octal_string()
- to_exp() / to_exp_string()
- to_pointer() / to_pointer_string()
- to_debug() / to_debug_string()
Add this in your Cargo.toml:
[dependencies]
to_string = "0.1"
and add this to your lib.rs or main.rs:
extern crate to_string;
use to_string::*;