INNER CODE UNIT · Rust
id
RustAudio/cpal · src/lib.rs:302
pub fn id(&self) -> &str {
&self.1
}
}
impl std::fmt::Display for DeviceId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}:{}", self.host(), self.id())
}
}
impl std::str::FromStr for DeviceId {
type Err = Error;
/// Parse a device identifier from its string representation (e.g. `"alsa:hw:0,0"`).
///
/// The format is `"<host>:<device>"` where `<host>` is the lowercase host name (see
/// [`HostId`]) and `<device>` is the device-specific identifier string.