INNER CODE UNIT · Rust
new
RustAudio/cpal · src/lib.rs:292
pub fn new(host: crate::platform::HostId, id: impl AsRef<str>) -> Self {
Self(host, Box::from(id.as_ref()))
}
/// Returns the host this device belongs to.
pub fn host(&self) -> crate::platform::HostId {
self.0
}
/// Returns the backend-specific device identifier string.
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())