Moved existing mod out of the way.

This commit is contained in:
Jeff Baskin 2023-04-03 14:59:40 -04:00
parent 6d61af5136
commit 685ddfe32d

View File

@ -112,22 +112,9 @@ impl FileData<Self> for DataType {
}
}
pub struct IDs;
impl IDs {
pub fn new() -> Self {
Self {}
}
}
impl ID for IDs {
fn next(&self) -> String {
thread_rng().sample_iter(&Alphanumeric).take(64).collect()
}
}
#[derive(Clone)]
pub struct MoreThanText {
next_id: &dyn Fn() -> String,
session: Vec<String>,
}
@ -153,6 +140,7 @@ impl MoreThanText {
}
}
Ok(Self {
next_id: fn id() -> String { thread_rng().sample_iter(&Alphanumeric).take(64).collect() },
session: [ENTRY.to_string()].to_vec(),
})
}
@ -325,27 +313,6 @@ mod datatype_file {
}
}
#[cfg(test)]
mod ids {
use super::*;
#[test]
fn get_next() {
let ids = IDs::new();
let mut holder: Vec<String> = Vec::new();
for _ in 0..10 {
let id = ids.next();
assert!(
!holder.contains(&id),
"No duplicates: found {} in {:?}",
id,
holder
);
holder.push(id);
}
}
}
#[cfg(test)]
mod db {
use super::*;