Update examples eprintln to more accurately reflect error

This commit is contained in:
mitchmindtree 2019-06-24 20:57:01 +02:00
parent c05d2916b1
commit c72bafd8ab
5 changed files with 7 additions and 7 deletions

View File

@ -21,7 +21,7 @@ fn main() -> Result<(), failure::Error> {
let data = match result {
Ok(data) => data,
Err(err) => {
eprintln!("stream {:?} closed due to an error: {}", id, err);
eprintln!("an error occurred on stream {:?}: {}", id, err);
return;
}
};

View File

@ -53,7 +53,7 @@ fn main() -> Result<(), failure::Error> {
let data = match result {
Ok(data) => data,
Err(err) => {
eprintln!("stream {:?} closed due to an error: {}", id, err);
eprintln!("an error occurred on stream {:?}: {}", id, err);
return;
}
};

View File

@ -34,7 +34,7 @@ fn main() -> Result<(), failure::Error> {
let data = match event {
Ok(data) => data,
Err(err) => {
eprintln!("stream {:?} closed due to an error: {}", id, err);
eprintln!("an error occurred on stream {:?}: {}", id, err);
return;
}
};

View File

@ -45,7 +45,7 @@ impl EventLoop {
#[inline]
pub fn run<F>(&self, callback: F) -> !
where F: FnMut(StreamId, StreamDataResult) + Send,
where F: FnMut(StreamId, StreamDataResult),
{
// The `run` function uses `set_timeout` to invoke a Rust callback repeatidely. The job
// of this callback is to fill the content of the audio buffers.

View File

@ -70,7 +70,7 @@
//!
//! ```no_run
//! # let event_loop = cpal::EventLoop::new();
//! event_loop.run(move |_stream_id, _stream_event| {
//! event_loop.run(move |_stream_id, _stream_result| {
//! // react to stream events and read or write stream data here
//! });
//! ```
@ -90,8 +90,8 @@
//! use cpal::{StreamData, UnknownTypeOutputBuffer};
//!
//! # let event_loop = cpal::EventLoop::new();
//! event_loop.run(move |stream_id, stream_event| {
//! let stream_data = match stream_event {
//! event_loop.run(move |stream_id, stream_result| {
//! let stream_data = match stream_result {
//! Ok(data) => data,
//! Err(err) => {
//! eprintln!("an error occurred on stream {:?}: {}", stream_id, err);