INNER CODE UNIT · Rust
fmt
RustAudio/cpal · src/lib.rs:308
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.
///
/// # Errors
///
/// - [`ErrorKind::InvalidInput`] if the string is not in `"host:device"` format.
/// - [`ErrorKind::UnsupportedOperation`] if the host portion names a host not available on this
/// platform.