Update examples eprintln to more accurately reflect error
This commit is contained in:
parent
c05d2916b1
commit
c72bafd8ab
|
@ -21,7 +21,7 @@ fn main() -> Result<(), failure::Error> {
|
||||||
let data = match result {
|
let data = match result {
|
||||||
Ok(data) => data,
|
Ok(data) => data,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("stream {:?} closed due to an error: {}", id, err);
|
eprintln!("an error occurred on stream {:?}: {}", id, err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,7 +53,7 @@ fn main() -> Result<(), failure::Error> {
|
||||||
let data = match result {
|
let data = match result {
|
||||||
Ok(data) => data,
|
Ok(data) => data,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("stream {:?} closed due to an error: {}", id, err);
|
eprintln!("an error occurred on stream {:?}: {}", id, err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,7 @@ fn main() -> Result<(), failure::Error> {
|
||||||
let data = match event {
|
let data = match event {
|
||||||
Ok(data) => data,
|
Ok(data) => data,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("stream {:?} closed due to an error: {}", id, err);
|
eprintln!("an error occurred on stream {:?}: {}", id, err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl EventLoop {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn run<F>(&self, callback: F) -> !
|
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
|
// 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.
|
// of this callback is to fill the content of the audio buffers.
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # let event_loop = cpal::EventLoop::new();
|
//! # 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
|
//! // react to stream events and read or write stream data here
|
||||||
//! });
|
//! });
|
||||||
//! ```
|
//! ```
|
||||||
|
@ -90,8 +90,8 @@
|
||||||
//! use cpal::{StreamData, UnknownTypeOutputBuffer};
|
//! use cpal::{StreamData, UnknownTypeOutputBuffer};
|
||||||
//!
|
//!
|
||||||
//! # let event_loop = cpal::EventLoop::new();
|
//! # let event_loop = cpal::EventLoop::new();
|
||||||
//! event_loop.run(move |stream_id, stream_event| {
|
//! event_loop.run(move |stream_id, stream_result| {
|
||||||
//! let stream_data = match stream_event {
|
//! let stream_data = match stream_result {
|
||||||
//! Ok(data) => data,
|
//! Ok(data) => data,
|
||||||
//! Err(err) => {
|
//! Err(err) => {
|
||||||
//! eprintln!("an error occurred on stream {:?}: {}", stream_id, err);
|
//! eprintln!("an error occurred on stream {:?}: {}", stream_id, err);
|
||||||
|
|
Loading…
Reference in New Issue