Expand description
This library solves a very specific problem: You have a (possibly generic) constant integer, and you want it as a &'static str.
All methods are named const_str_ and then the type.
use const_stringify_ints::*;
const SIZE_OF_MY_ARR:usize = 294;
const SIZE_STR:&'static str = const_str_usize::<SIZE_OF_MY_ARR>();
assert_eq!(SIZE_OF_MY_ARR.to_string().as_str(), SIZE_STR);§Support
This library supports no_std environments.
This library should in theory support targets with a 16-bit, however I don’t have a way of testing this. Additionaly, these targets are likely very memory-constrained, and this crate always ‘allocates’ 5 bytes of static memory for a u16 even when only 1 byte is needed.
Functions§
- const_
str_ i8 - Returns the const parameter
Nas a&'static str. - const_
str_ i16 - Returns the const parameter
Nas a&'static str. - const_
str_ i32 - Returns the const parameter
Nas a&'static str. - const_
str_ i64 - Returns the const parameter
Nas a&'static str. - const_
str_ i128 - Returns the const parameter
Nas a&'static str. - const_
str_ isize - Returns the const parameter
Nas a&'static str. - const_
str_ u8 - Returns the const parameter
Nas a&'static str. - const_
str_ u16 - Returns the const parameter
Nas a&'static str. - const_
str_ u32 - Returns the const parameter
Nas a&'static str. - const_
str_ u64 - Returns the const parameter
Nas a&'static str. - const_
str_ u128 - Returns the const parameter
Nas a&'static str. - const_
str_ usize - Returns the const parameter
Nas a&'static str.