mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-07 11:59:59 +03:00
Fix parsing TOML key 'position' and values (#281)
* fix parsing toml key position and values * Using rename_all instead rename over each enum * rename struct field directly --------- Co-authored-by: Ferdinand Schober <ferdinand.schober@fau.de>
This commit is contained in:
@@ -59,6 +59,7 @@ pub enum IpcError {
|
||||
pub const DEFAULT_PORT: u16 = 4242;
|
||||
|
||||
#[derive(Debug, Default, Eq, Hash, PartialEq, Clone, Copy, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum Position {
|
||||
#[default]
|
||||
Left,
|
||||
|
||||
@@ -61,7 +61,7 @@ struct TomlClient {
|
||||
host_name: Option<String>,
|
||||
ips: Option<Vec<IpAddr>>,
|
||||
port: Option<u16>,
|
||||
pos: Option<Position>,
|
||||
position: Option<Position>,
|
||||
activate_on_startup: Option<bool>,
|
||||
enter_hook: Option<String>,
|
||||
}
|
||||
@@ -262,7 +262,7 @@ impl From<TomlClient> for ConfigClient {
|
||||
let hostname = toml.hostname;
|
||||
let ips = HashSet::from_iter(toml.ips.into_iter().flatten());
|
||||
let port = toml.port.unwrap_or(DEFAULT_PORT);
|
||||
let pos = toml.pos.unwrap_or_default();
|
||||
let pos = toml.position.unwrap_or_default();
|
||||
Self {
|
||||
ips,
|
||||
hostname,
|
||||
|
||||
Reference in New Issue
Block a user