mirror of https://github.com/ndarilek/tts-rs.git
Add `Default` implementation for `Features` so backends need only specify features they actually support.
This commit is contained in:
parent
951e31b284
commit
1507527175
|
@ -95,9 +95,9 @@ impl Backend for AppKit {
|
||||||
Features {
|
Features {
|
||||||
stop: true,
|
stop: true,
|
||||||
rate: true,
|
rate: true,
|
||||||
pitch: false,
|
|
||||||
volume: true,
|
volume: true,
|
||||||
is_speaking: true,
|
is_speaking: true,
|
||||||
|
..Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,7 @@ impl Backend for Tolk {
|
||||||
fn supported_features(&self) -> Features {
|
fn supported_features(&self) -> Features {
|
||||||
Features {
|
Features {
|
||||||
stop: true,
|
stop: true,
|
||||||
rate: false,
|
..Default::default(),
|
||||||
pitch: false,
|
|
||||||
volume: false,
|
|
||||||
is_speaking: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -48,6 +48,18 @@ pub struct Features {
|
||||||
pub is_speaking: bool,
|
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)]
|
#[derive(Debug, Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("IO error: {0}")]
|
#[error("IO error: {0}")]
|
||||||
|
|
Loading…
Reference in New Issue