INNER CODE UNIT · Rust
from_str
RustAudio/cpal · src/lib.rs:329
fn from_str(s: &str) -> Result<Self, Self::Err> {
let (host_str, device_str) = s.split_once(':').ok_or_else(|| {
Error::with_message(
ErrorKind::InvalidInput,
format!("failed to parse device ID \"{s}\": expected \"host:device_id\" format"),
)
})?;
let host_id = crate::platform::HostId::from_str(host_str)?;
Ok(Self::new(host_id, device_str))
}
}
/// The buffer size requests the callback size for audio streams.
///
/// This controls the approximate size of the audio buffer passed to your callback.
/// The actual callback size depends on the host/platform implementation and hardware