implement unique ID function
This commit is contained in:
parent
2ca4e7db18
commit
280dea62ae
12
src/lib.rs
12
src/lib.rs
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue