Skip to main content

AudioStream

Trait AudioStream 

Source
pub trait AudioStream {
    // Required methods
    fn play(&self) -> Result<(), Box<dyn Error>>;
    fn pause(&self) -> Result<(), Box<dyn Error>>;
}
Expand description

Audio stream trait for controlling playback.

Deliberately not Send: real backends (cpal among them) make their stream handle thread-affine — construction, play/pause and teardown must all happen on the thread that opened the device. Implementations that are movable simply also implement Send; nothing here takes that away.

Required Methods§

Source

fn play(&self) -> Result<(), Box<dyn Error>>

Start playback

Source

fn pause(&self) -> Result<(), Box<dyn Error>>

Pause playback

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§