implement ToBase36 for u64; room id to u64; sprite id to u64; tile id to u64; sprite.dialogue -> sprite.dialogue_id
This commit is contained in:
17
src/lib.rs
17
src/lib.rs
@@ -76,11 +76,22 @@ fn test_from_base36() {
|
||||
assert_eq!(from_base36("11"), 37);
|
||||
}
|
||||
|
||||
fn to_base36(input: u64) -> String {
|
||||
format!("{}", radix_36(input))
|
||||
/// this doesn't work inside ToBase36 for some reason
|
||||
fn to_base36(int: u64) -> String {
|
||||
format!("{}", radix_36(int))
|
||||
}
|
||||
|
||||
pub trait ToBase36 {
|
||||
fn to_base36(&self) -> String;
|
||||
}
|
||||
|
||||
impl ToBase36 for u64 {
|
||||
fn to_base36(&self) -> String {
|
||||
to_base36(*self)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_base36() {
|
||||
assert_eq!(to_base36(37), "11");
|
||||
assert_eq!((37 as u64).to_base36(), "11");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user