Skip to main content

v_common/v_api/
obj.rs

1use nanoid::nanoid;
2
3pub fn generate_unique_uri(prefix: &str, postfix: &str) -> String {
4    let alphabet: [char; 36] = [
5        '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
6        't', 'u', 'v', 'w', 'x', 'y', 'z',
7    ];
8
9    format!("{}{}{}", prefix, nanoid!(24, &alphabet), postfix)
10}