mirror of https://github.com/ndarilek/tts-rs.git
Common traits for Features
This commit is contained in:
parent
d24d1a6a15
commit
9ed03753c2
|
@ -16,6 +16,7 @@ dyn-clonable = "0.9"
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
|
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
|
|
23
src/lib.rs
23
src/lib.rs
|
@ -16,6 +16,7 @@ use std::boxed::Box;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
|
use std::fmt;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||||
|
@ -84,13 +85,15 @@ unsafe impl Send for UtteranceId {}
|
||||||
|
|
||||||
unsafe impl Sync 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 struct Features {
|
||||||
pub stop: bool,
|
|
||||||
pub rate: bool,
|
|
||||||
pub pitch: bool,
|
|
||||||
pub volume: bool,
|
|
||||||
pub is_speaking: bool,
|
pub is_speaking: bool,
|
||||||
|
pub pitch: bool,
|
||||||
|
pub rate: bool,
|
||||||
|
pub stop: bool,
|
||||||
pub utterance_callbacks: bool,
|
pub utterance_callbacks: bool,
|
||||||
|
pub volume: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Features {
|
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)]
|
#[derive(Debug, Error)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("IO error: {0}")]
|
#[error("IO error: {0}")]
|
||||||
|
|
Loading…
Reference in New Issue