Skip to content

Commit

Permalink
fix various example issues
Browse files Browse the repository at this point in the history
  • Loading branch information
adryzz committed Feb 23, 2024
1 parent a32d79f commit f885e26
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ctru-rs/src/services/ac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ impl Ac {
}
}

/// Returns whether the console is connected to Wi-Fi
/// Returns the [SecurityMode] of the currently connected network, or error if the console isn't connected to any network.
///
/// You can check if the console is connected to a network using [`Ac::get_wifi_status()`]
/// # Example
///
/// ```
Expand All @@ -102,6 +103,10 @@ impl Ac {
///
/// let ac = Ac::new()?;
///
/// if ac.get_wifi_status() {
/// println!("Network security: {:?}");
/// }
///
/// #
/// # Ok(())
/// # }
Expand All @@ -119,7 +124,7 @@ impl Ac {

/// Returns the SSID of the Wi-Fi network the console is connected to, or error if the console isn't connected to any network.
///
/// You can check if the console is connected to a network using [`Self::get_wifi_status()`]
/// You can check if the console is connected to a network using [`Ac::get_wifi_status()`]
///
/// # Example
///
Expand All @@ -145,7 +150,6 @@ impl Ac {
// we don't really need space for the terminator
let mut vec = vec![0u8; len as usize];
ResultCode(ctru_sys::ACU_GetSSID(vec.as_mut_ptr()))?;
// how do i handle this error?
Ok(String::from_utf8(vec)?)
}
}
Expand Down Expand Up @@ -181,7 +185,7 @@ impl Ac {

/// Returns the connected network's proxy port, if present.
///
/// You can check if the console is using a proxy with [`Self::get_proxy_enabled()`]
/// You can check if the console is using a proxy with [`Ac::get_proxy_enabled()`]
///
/// # Example
///
Expand Down Expand Up @@ -211,7 +215,7 @@ impl Ac {

/// Returns the connected network's proxy username, if present.
///
/// You can check if the console is using a proxy with [`Self::get_proxy_enabled()`]
/// You can check if the console is using a proxy with [`Ac::get_proxy_enabled()`]
///
/// # Example
///
Expand All @@ -236,14 +240,13 @@ impl Ac {
let mut vec = vec![0u8; 0x20];
ResultCode(ctru_sys::ACU_GetProxyUserName(vec.as_mut_ptr()))?;

// how do i handle this error?
Ok(String::from_utf8(vec)?)
}
}

/// Returns the connected network's proxy password, if present.
///
/// You can check if the console is using a proxy with [`Self::get_proxy_enabled()`]
/// You can check if the console is using a proxy with [`Ac::get_proxy_enabled()`]
///
/// # Example
///
Expand All @@ -267,7 +270,6 @@ impl Ac {
let mut vec = vec![0u8; 0x20];
ResultCode(ctru_sys::ACU_GetProxyPassword(vec.as_mut_ptr()))?;

// how do i handle this error?
Ok(String::from_utf8(vec)?)
}
}
Expand All @@ -282,7 +284,7 @@ impl Ac {
/// # use std::error::Error;
/// # fn main() -> Result<(), Box<dyn Error>> {
/// #
/// use ctru::services::ac::Ac;
/// use ctru::services::ac::{Ac, NetworkSlot};
///
/// let ac = Ac::new()?;
///
Expand Down

0 comments on commit f885e26

Please sign in to comment.