implement unique ID function

This commit is contained in:
Max Bradbury 2020-06-23 16:14:22 +01:00
parent 2ca4e7db18
commit 280dea62ae
1 changed files with 11 additions and 1 deletions

View File

@ -148,7 +148,17 @@ fn segments_from_string(string: String) -> Vec<String> {
/// e.g. pass all tile IDs into this to get a new non-conflicting tile ID /// e.g. pass all tile IDs into this to get a new non-conflicting tile ID
#[inline] #[inline]
fn new_unique_id(ids: Vec<String>) -> String { fn new_unique_id(ids: Vec<String>) -> String {
"hello".to_string() let mut new_id: u64 = 0;
for id in ids {
if new_id != from_base36(&id) {
break;
}
new_id += 1;
}
return to_base36(new_id);
} }
pub trait Quote { pub trait Quote {