Remove unspecified gender in favor of `Option`.

pull/26/head
Nolan Darilek 8 months ago
parent 2b4251f6fa
commit 9bd767629a
  1. 6
      src/backends/av_foundation.rs
  2. 5
      src/lib.rs

@ -298,9 +298,9 @@ impl Backend for AvFoundation {
let name: CFString = unsafe { msg_send![*v as *const Object, name] };
let gender: i64 = unsafe { msg_send![*v as *const Object, gender] };
let gender = match gender {
0 => Gender::Male,
1 => Gender::Female,
_ => Gender::Unspecified,
0 => Some(Gender::Male),
1 => Some(Gender::Female),
_ => None,
};
let language: CFString = unsafe { msg_send![*v as *const Object, language] };
let language = language.to_string();

@ -704,7 +704,6 @@ impl Drop for Tts {
#[derive(Clone, Copy, Debug)]
pub enum Gender {
Unspecified,
Male,
Female,
}
@ -713,7 +712,7 @@ pub enum Gender {
pub struct Voice {
pub(crate) id: String,
pub(crate) name: String,
pub(crate) gender: Gender,
pub(crate) gender: Option<Gender>,
pub(crate) language: LanguageIdentifier,
}
@ -726,7 +725,7 @@ impl Voice {
self.name.clone()
}
pub fn gender(&self) -> Gender {
pub fn gender(&self) -> Option<Gender> {
self.gender
}

Loading…
Cancel
Save