Add base server

This commit is contained in:
2023-05-24 14:38:18 +02:00
parent df64d51445
commit 9912428fd6
10 changed files with 1292 additions and 19 deletions

View File

@ -0,0 +1,28 @@
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct SizeConstraint {
min: usize,
max: usize,
}
impl SizeConstraint {
pub fn new(min: usize, max: usize) -> Self {
Self { min, max }
}
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct StaticConstraints {
pub mail_len: SizeConstraint,
pub user_name_len: SizeConstraint,
pub password_len: SizeConstraint,
}
impl Default for StaticConstraints {
fn default() -> Self {
Self {
mail_len: SizeConstraint::new(5, 255),
user_name_len: SizeConstraint::new(3, 30),
password_len: SizeConstraint::new(8, 255),
}
}
}