Skip to content

Commit

Permalink
chore: Add default to connection
Browse files Browse the repository at this point in the history
  • Loading branch information
DashieTM committed Nov 20, 2023
1 parent 23e0023 commit b234476
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ReSet-Lib"
version = "0.3.5"
version = "0.3.6"
edition = "2021"
description = "Data structure library for ReSet"
repository = "https://github.com/Xetibo/ReSet-Lib"
Expand Down
16 changes: 10 additions & 6 deletions src/network/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct ConversionError {
message: &'static str,
}

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct Connection {
pub settings: ConnectionSettings,
// x802: X802Settings,
Expand Down Expand Up @@ -85,6 +85,7 @@ impl Connection {
TypeSettings::WIFI(wifi) => wifi.to_propmap(&mut map),
TypeSettings::ETHERNET(ethernet) => ethernet.to_propmap(&mut map),
TypeSettings::VPN(vpn) => vpn.to_propmap(&mut map),
TypeSettings::None => (),
}
self.ipv4.to_propmap(&mut map);
self.ipv6.to_propmap(&mut map);
Expand Down Expand Up @@ -284,11 +285,13 @@ impl Enum for Duplex {
}
}

#[derive(Debug)]
#[derive(Debug, Default)]
pub enum TypeSettings {
WIFI(WifiSettings),
ETHERNET(EthernetSettings),
VPN(VPNSettings),
#[default]
None,
}

impl ToString for TypeSettings {
Expand All @@ -297,11 +300,12 @@ impl ToString for TypeSettings {
TypeSettings::WIFI(_) => String::from("wifi"),
TypeSettings::ETHERNET(_) => String::from("ethernet"),
TypeSettings::VPN(_) => String::from("vpn"),
TypeSettings::None => String::from(""),
}
}
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct EthernetSettings {
pub auto_negotiate: bool,
pub duplex: Duplex,
Expand Down Expand Up @@ -671,7 +675,7 @@ impl Enum for DNSMethod {
}
}

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct IPV4Settings {
pub address_data: Vec<Address>,
pub dns: Vec<Vec<u8>>,
Expand Down Expand Up @@ -848,7 +852,7 @@ impl Enum for IPV6PrivacyMode {
}
}

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct IPV6Settings {
pub address_data: Vec<Address>,
pub dns: Vec<Vec<u8>>,
Expand Down Expand Up @@ -1011,7 +1015,7 @@ fn get_addresses(map: &PropMap, address_type: &'static str) -> Vec<Address> {
address_data
}

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct ConnectionSettings {
pub autoconnect: bool,
pub autoconnect_priority: i32,
Expand Down

0 comments on commit b234476

Please sign in to comment.