Add invite creation, removal, fetch and usage.

This commit is contained in:
Paul Makles
2020-04-11 21:48:10 +01:00
parent 1a41a68ee6
commit d1b44a311f
8 changed files with 271 additions and 38 deletions

View File

@@ -1,6 +1,14 @@
use hashbrown::HashSet;
use rand::{distributions::Alphanumeric, Rng};
use std::iter::FromIterator;
pub fn vec_to_set<T: Clone + Eq + std::hash::Hash>(data: &[T]) -> HashSet<T> {
HashSet::from_iter(data.iter().cloned())
}
pub fn gen_token(l: usize) -> String {
rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(l)
.collect::<String>()
}