Bump version, and use automatically-provided feature provided by optional tolk dependency.

This commit is contained in:
Nolan Darilek 2021-01-21 10:49:11 -06:00
parent 3e1f5af61a
commit 296fa89f5d
5 changed files with 10 additions and 13 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "tts" name = "tts"
version = "0.13.1" version = "0.14.0"
authors = ["Nolan Darilek <nolan@thewordnerd.info>"] authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
repository = "https://github.com/ndarilek/tts-rs" repository = "https://github.com/ndarilek/tts-rs"
description = "High-level Text-To-Speech (TTS) interface" description = "High-level Text-To-Speech (TTS) interface"
@ -11,9 +11,6 @@ edition = "2018"
[lib] [lib]
crate-type = ["lib", "cdylib", "staticlib"] crate-type = ["lib", "cdylib", "staticlib"]
[features]
use_tolk = ["tolk"]
[dependencies] [dependencies]
dyn-clonable = "0.9" dyn-clonable = "0.9"
lazy_static = "1" lazy_static = "1"

View File

@ -3,7 +3,7 @@
This library provides a high-level Text-To-Speech (TTS) interface supporting various backends. Currently supported backends are: This library provides a high-level Text-To-Speech (TTS) interface supporting various backends. Currently supported backends are:
* Windows * Windows
* Screen readers/SAPI via Tolk (requires `use_tolk` Cargo feature) * Screen readers/SAPI via Tolk (requires `tolk` Cargo feature)
* WinRT * WinRT
* Linux via [Speech Dispatcher](https://freebsoft.org/speechd) * Linux via [Speech Dispatcher](https://freebsoft.org/speechd)
* MacOS/iOS * MacOS/iOS

View File

@ -1,7 +1,7 @@
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
mod speech_dispatcher; mod speech_dispatcher;
#[cfg(all(windows, feature = "use_tolk"))] #[cfg(all(windows, feature = "tolk"))]
mod tolk; mod tolk;
#[cfg(windows)] #[cfg(windows)]
@ -22,7 +22,7 @@ mod android;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
pub(crate) use self::speech_dispatcher::*; pub(crate) use self::speech_dispatcher::*;
#[cfg(all(windows, feature = "use_tolk"))] #[cfg(all(windows, feature = "tolk"))]
pub(crate) use self::tolk::*; pub(crate) use self::tolk::*;
#[cfg(windows)] #[cfg(windows)]

View File

@ -1,4 +1,4 @@
#[cfg(all(windows, feature = "use_tolk"))] #[cfg(all(windows, feature = "tolk"))]
use log::{info, trace}; use log::{info, trace};
use tolk::Tolk as TolkPtr; use tolk::Tolk as TolkPtr;

View File

@ -2,7 +2,7 @@
* a Text-To-Speech (TTS) library providing high-level interfaces to a variety of backends. * a Text-To-Speech (TTS) library providing high-level interfaces to a variety of backends.
* Currently supported backends are: * Currently supported backends are:
* * Windows * * Windows
* * Screen readers/SAPI via Tolk (requires `use_tolk` Cargo feature) * * Screen readers/SAPI via Tolk (requires `tolk` Cargo feature)
* * WinRT * * WinRT
* * Linux via [Speech Dispatcher](https://freebsoft.org/speechd) * * Linux via [Speech Dispatcher](https://freebsoft.org/speechd)
* * MacOS/iOS * * MacOS/iOS
@ -36,7 +36,7 @@ pub enum Backends {
SpeechDispatcher, SpeechDispatcher,
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
Web, Web,
#[cfg(all(windows, feature = "use_tolk"))] #[cfg(all(windows, feature = "tolk"))]
Tolk, Tolk,
#[cfg(windows)] #[cfg(windows)]
WinRT, WinRT,
@ -187,7 +187,7 @@ impl TTS {
let tts = backends::Web::new()?; let tts = backends::Web::new()?;
Ok(TTS(Box::new(tts))) Ok(TTS(Box::new(tts)))
} }
#[cfg(all(windows, feature = "use_tolk"))] #[cfg(all(windows, feature = "tolk"))]
Backends::Tolk => { Backends::Tolk => {
let tts = backends::Tolk::new(); let tts = backends::Tolk::new();
if let Some(tts) = tts { if let Some(tts) = tts {
@ -225,13 +225,13 @@ impl TTS {
pub fn default() -> Result<TTS, Error> { pub fn default() -> Result<TTS, Error> {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let tts = TTS::new(Backends::SpeechDispatcher); let tts = TTS::new(Backends::SpeechDispatcher);
#[cfg(all(windows, feature = "use_tolk"))] #[cfg(all(windows, feature = "tolk"))]
let tts = if let Ok(tts) = TTS::new(Backends::Tolk) { let tts = if let Ok(tts) = TTS::new(Backends::Tolk) {
Ok(tts) Ok(tts)
} else { } else {
TTS::new(Backends::WinRT) TTS::new(Backends::WinRT)
}; };
#[cfg(all(windows, not(feature = "use_tolk")))] #[cfg(all(windows, not(feature = "tolk")))]
let tts = TTS::new(Backends::WinRT); let tts = TTS::new(Backends::WinRT);
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
let tts = TTS::new(Backends::Web); let tts = TTS::new(Backends::Web);