1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
pub use constants::*;
pub use types::*;
pub use variants::*;
pub use bson::{oid::ObjectId, DateTime as BsonDateTime};
pub use chrono::{DateTime, Utc};
pub use config::{
builder::{AsyncState as AsyncConfigState, DefaultState as ConfigDefaultState},
AsyncConfigBuilder, Config, ConfigBuilder, ConfigError, File as ConfigFile,
};
pub use serde::{Deserialize, Serialize};
mod constants;
mod types;
mod variants;
#[derive(Clone, Debug, Hash, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct Prefix(String);
impl Prefix {
pub fn new(data: String) -> Self {
Self(data)
}
pub fn from<T: Clone + std::string::ToString>(data: T) -> Self {
Self::new(data.to_string())
}
}
impl Default for Prefix {
fn default() -> Self {
Self::from("")
}
}
#[cfg(test)]
mod tests {
use super::Prefix;
#[test]
fn test_prefix() {
let actual = Prefix::default();
let expected = Prefix::from("");
assert_eq!(&actual, &expected)
}
}