Add comment about Sink and OutputStream

This commit is contained in:
weixubin 2024-04-22 16:20:14 +08:00
parent a618afccf9
commit 934b1c0525

View file

@ -51,6 +51,7 @@
//! use rodio::{Decoder, OutputStream, Sink};
//! use rodio::source::{SineWave, Source};
//!
//! // _stream must live as long as the sink
//! let (_stream, stream_handle) = OutputStream::try_default().unwrap();
//! let sink = Sink::try_new(&stream_handle).unwrap();
//!
@ -69,6 +70,8 @@
//!
//! The [`Sink`] type also provides utilities such as playing/pausing or controlling the volume.
//!
//! **Please note that the [`Sink`] requires the [`OutputStream`], thus ensuring that it has to live as long as the sink.**
//!
//! ## Filters
//!
//! The [`Source`] trait provides various filters, similar to the standard [`Iterator`] trait.