Start local server on client run

This commit is contained in:
2022-10-01 20:44:01 +02:00
parent 14c5820ed2
commit 7a06feb7cf
18 changed files with 88 additions and 18 deletions

View File

@ -0,0 +1,23 @@
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
/// Generate a random string of a given size
pub fn rand_str(len: usize) -> String {
thread_rng()
.sample_iter(&Alphanumeric)
.map(char::from)
.take(len)
.collect()
}
#[cfg(test)]
mod test {
use crate::utils::string_utils::rand_str;
#[test]
fn test_rand_str() {
let size = 10;
let rand = rand_str(size);
assert_eq!(size, rand.len());
}
}