Add `Default` implementation for `Features` so backends need only specify features they actually support.

This commit is contained in:
Nolan Darilek 2020-08-24 16:44:00 -05:00
parent 951e31b284
commit 1507527175
3 changed files with 14 additions and 5 deletions

View File

@ -95,9 +95,9 @@ impl Backend for AppKit {
Features {
stop: true,
rate: true,
pitch: false,
volume: true,
is_speaking: true,
..Default::default(),
}
}

View File

@ -22,10 +22,7 @@ impl Backend for Tolk {
fn supported_features(&self) -> Features {
Features {
stop: true,
rate: false,
pitch: false,
volume: false,
is_speaking: false,
..Default::default(),
}
}

View File

@ -48,6 +48,18 @@ pub struct Features {
pub is_speaking: bool,
}
impl Default for Features {
fn default() -> Self {
Self {
stop: false,
rate: false,
pitch: false,
volume: false,
is_speaking: false,
}
}
}
#[derive(Debug, Error)]
pub enum Error {
#[error("IO error: {0}")]