feat: display error overlay (#607)

Co-authored-by: Marco Pasqualetti <marco.pasqualetti@live.com>
This commit is contained in:
Valerio Ageno
2025-03-09 11:32:05 +01:00
committed by GitHub
parent da194524ee
commit 77c902a7a5
7 changed files with 412 additions and 15 deletions
+25 -1
View File
@@ -10,7 +10,17 @@ pub struct ServerConfig {
pub port: u16,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
impl Default for ServerConfig {
fn default() -> Self {
ServerConfig {
host: "localhost".to_string(),
origin: None,
port: 3000,
}
}
}
#[derive(Deserialize, Serialize, Debug, Clone, Default)]
pub struct Config {
pub server: ServerConfig,
}
@@ -23,3 +33,17 @@ impl Config {
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_config_default() {
let config = Config::default();
assert_eq!(config.server.host, "localhost".to_string());
assert_eq!(config.server.origin, None);
assert_eq!(config.server.port, 3000);
}
}