mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-17 13:09:37 +00:00
Common traits for Features
This commit is contained in:
parent
d24d1a6a15
commit
9ed03753c2
|
@ -16,6 +16,7 @@ dyn-clonable = "0.9"
|
|||
lazy_static = "1"
|
||||
log = "0.4"
|
||||
thiserror = "1"
|
||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.9"
|
||||
|
|
23
src/lib.rs
23
src/lib.rs
|
@ -16,6 +16,7 @@ use std::boxed::Box;
|
|||
use std::collections::HashMap;
|
||||
#[cfg(target_os = "macos")]
|
||||
use std::ffi::CStr;
|
||||
use std::fmt;
|
||||
use std::sync::Mutex;
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
|
@ -84,13 +85,15 @@ unsafe impl Send for UtteranceId {}
|
|||
|
||||
unsafe impl Sync for UtteranceId {}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct Features {
|
||||
pub stop: bool,
|
||||
pub rate: bool,
|
||||
pub pitch: bool,
|
||||
pub volume: bool,
|
||||
pub is_speaking: bool,
|
||||
pub pitch: bool,
|
||||
pub rate: bool,
|
||||
pub stop: bool,
|
||||
pub utterance_callbacks: bool,
|
||||
pub volume: bool,
|
||||
}
|
||||
|
||||
impl Default for Features {
|
||||
|
@ -106,6 +109,18 @@ impl Default for Features {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Features {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
writeln!(f, "{:#?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl Features {
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
#[error("IO error: {0}")]
|
||||
|
|
Loading…
Reference in New Issue
Block a user