1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-17 11:29:37 +00:00

Merge extra module into main module.

This commit is contained in:
Nolan Darilek 2022-03-30 10:54:30 -05:00
parent c222c087b2
commit 55f841d887
2 changed files with 20 additions and 21 deletions

View File

@ -22,6 +22,7 @@ use std::{boxed::Box, sync::RwLock};
#[cfg(any(target_os = "macos", target_os = "ios"))]
use cocoa_foundation::base::id;
use dyn_clonable::*;
pub use unic_langid::LanguageIdentifier;
use lazy_static::lazy_static;
#[cfg(target_os = "macos")]
use libc::c_char;
@ -34,7 +35,6 @@ use thiserror::Error;
use tolk::Tolk;
mod backends;
mod voices;
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@ -690,3 +690,22 @@ impl Drop for Tts {
}
}
}
pub enum Gender {
Other,
Male,
Female,
}
pub trait VoiceImpl: Sized {
type Backend: crate::Backend;
fn from_id(id: String) -> Self;
fn from_language(lang: LanguageIdentifier) -> Self;
fn list() -> Vec<Self>;
fn name(self) -> String;
fn gender(self) -> Gender;
fn id(self) -> String;
fn language(self) -> LanguageIdentifier;
}
pub struct Voice<T: VoiceImpl + Sized>(Box<T>);

View File

@ -1,20 +0,0 @@
pub use unic_langid::LanguageIdentifier;
pub enum Gender {
Other,
Male,
Female,
}
pub trait Backend: Sized {
type Backend: crate::Backend;
fn from_id(id: String) -> Self;
fn from_language(lang: LanguageIdentifier) -> Self;
fn list() -> Vec<Self>;
fn name(self) -> String;
fn gender(self) -> Gender;
fn id(self) -> String;
fn language(self) -> LanguageIdentifier;
}
pub struct Voice<T: Backend + Sized>(Box<T>);