pub trait SoundProvider {
// Required methods
fn play(&self, clip: &SoundClip);
fn speak(&self, text: &str, language: &str);
fn stop_speaking(&self);
// Provided method
fn speak_clip(&self, clip: &SoundClip) { ... }
}Expand description
Plays sounds and speaks. Platform layers install one with
crate::Ui::set_sound; until then, nothing is heard.
Required Methods§
Sourcefn speak(&self, text: &str, language: &str)
fn speak(&self, text: &str, language: &str)
Says text with the system’s voice for language, such as pt-BR, in
place of anything still being said.
Sourcefn stop_speaking(&self)
fn stop_speaking(&self)
Stops what is being said.
Provided Methods§
Sourcefn speak_clip(&self, clip: &SoundClip)
fn speak_clip(&self, clip: &SoundClip)
Says a recording, in place of anything still being said, so that
SoundProvider::stop_speaking stops it. By default it only plays.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".