Skip to content

Commit

Permalink
Replace with more senseful implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Empire committed Jan 5, 2024
1 parent 757c838 commit 1b4fc7d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,17 @@ impl TryFrom<&ClientConfiguration> for Newtype<wifi_sta_config_t> {

impl From<Newtype<wifi_sta_config_t>> for ClientConfiguration {
fn from(conf: Newtype<wifi_sta_config_t>) -> Self {
let auth_method: Option<AuthMethod> = Newtype(conf.0.threshold.authmode).into();

Self {
ssid: from_cstr(&conf.0.ssid).into(),
ssid: from_cstr(&conf.0.ssid).try_into().unwrap(),
bssid: if conf.0.bssid_set {
Some(conf.0.bssid)
} else {
None
},
auth_method: auth_method.unwrap(),
auth_method: <Newtype<u32> as std::convert::Into<Option<AuthMethod>>>::into(Newtype(
conf.0.threshold.authmode,
))
.unwrap(),
password: from_cstr(&conf.0.password).try_into().unwrap(),
channel: if conf.0.channel != 0 {
Some(conf.0.channel)
Expand Down

0 comments on commit 1b4fc7d

Please sign in to comment.