Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion esp-radio/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,11 @@ impl Ssid {
})
}

pub(crate) fn as_bytes(&self) -> &[u8] {
/// The SSID as raw bytes.
///
/// An SSID is at most 32 bytes and is not required to be valid UTF-8.
#[instability::unstable]
pub fn as_bytes(&self) -> &[u8] {
&self.ssid[..self.len as usize]
}

Expand All @@ -797,6 +801,9 @@ impl Ssid {
}

/// The SSID as a string slice.
///
/// An SSID is not required to be valid UTF-8; the result stops at the
/// first invalid byte. Use [`as_bytes`][Self::as_bytes] for the full bytes.
pub fn as_str(&self) -> &str {
let part = &self.ssid[..self.len as usize];
match str::from_utf8(part) {
Expand Down