Finish making gender optional.

This commit is contained in:
Nolan Darilek 2022-03-31 13:25:08 -05:00
parent 9bd767629a
commit 822f770ab8
4 changed files with 5 additions and 8 deletions

View File

@ -13,7 +13,6 @@ crate-type = ["lib", "cdylib", "staticlib"]
[features]
speech_dispatcher_0_10 = ["speech-dispatcher/0_10"]
default = ["speech_dispatcher_0_10"]
[dependencies]
dyn-clonable = "0.9"

View File

@ -6,7 +6,7 @@ use log::{info, trace};
use speech_dispatcher::*;
use unic_langid::LanguageIdentifier;
use crate::{Backend, BackendId, Error, Features, Gender, UtteranceId, Voice, CALLBACKS};
use crate::{Backend, BackendId, Error, Features, UtteranceId, Voice, CALLBACKS};
#[derive(Clone, Debug)]
pub(crate) struct SpeechDispatcher(Connection);
@ -191,7 +191,7 @@ impl Backend for SpeechDispatcher {
.map(|v| Voice {
id: v.name.clone(),
name: v.name.clone(),
gender: Gender::Unspecified,
gender: None,
language: LanguageIdentifier::from_str(&v.language).unwrap(),
})
.collect::<Vec<Voice>>();

View File

@ -11,9 +11,7 @@ use web_sys::{
SpeechSynthesisUtterance, SpeechSynthesisVoice,
};
use crate::Gender;
use crate::Voice;
use crate::{Backend, BackendId, Error, Features, UtteranceId, CALLBACKS};
use crate::{Backend, BackendId, Error, Features, UtteranceId, Voice, CALLBACKS};
#[derive(Clone, Debug)]
pub struct Web {
@ -270,7 +268,7 @@ impl From<SpeechSynthesisVoice> for Voice {
Voice {
id: other.voice_uri(),
name: other.name(),
gender: Gender::Unspecified,
gender: None,
language,
}
}

View File

@ -354,7 +354,7 @@ impl TryInto<Voice> for VoiceInformation {
Ok(Voice {
id: self.Id()?.try_into()?,
name: self.DisplayName()?.try_into()?,
gender,
gender: Some(gender),
language,
})
}