Moved Oid into document module.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
@@ -1,12 +1,40 @@
|
||||
use crate::{
|
||||
action::Field,
|
||||
message::wrapper::Oid,
|
||||
mtterror::{ErrorID, MTTError},
|
||||
name::{Name, NameType, Names},
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct Oid {
|
||||
oid: Uuid,
|
||||
}
|
||||
|
||||
impl Oid {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
oid: Uuid::new_v4(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod oids {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn are_oids_random() {
|
||||
let count = 10;
|
||||
let mut holder: Vec<Oid> = Vec::new();
|
||||
while holder.len() < count {
|
||||
let result = Oid::new();
|
||||
assert!(!holder.contains(&result));
|
||||
holder.push(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct InternalRecord {
|
||||
data: HashMap<Uuid, Field>,
|
||||
|
||||
Reference in New Issue
Block a user