diff --git a/rslib/src/card_rendering/tts/windows.rs b/rslib/src/card_rendering/tts/windows.rs index 95cd9026d..a53994c2e 100644 --- a/rslib/src/card_rendering/tts/windows.rs +++ b/rslib/src/card_rendering/tts/windows.rs @@ -21,7 +21,7 @@ const MAX_BUFFER_SIZE: usize = 128 * 1024; pub(super) fn all_voices(validate: bool) -> Result> { SpeechSynthesizer::AllVoices()? .into_iter() - .map(|info| TtsVoice::from_voice_information(info, validate)) + .map(|info| tts_voice_from_information(info, validate)) .collect() } @@ -91,16 +91,14 @@ fn write_reader_to_file(reader: DataReader, file: &mut File, stream_size: usize) Ok(()) } -impl TtsVoice { - fn from_voice_information(info: VoiceInformation, validate: bool) -> Result { - Ok(Self { - id: info.Id()?.to_string_lossy(), - name: info.DisplayName()?.to_string_lossy(), - language: info.Language()?.to_string_lossy(), - // Windows lists voices that fail when actually trying to use them. This has been - // observed with voices from an uninstalled language pack. - // Validation is optional because it may be slow. - available: validate.then(|| synthesize_stream(&info, 1.0, "").is_ok()), - }) - } +fn tts_voice_from_information(info: VoiceInformation, validate: bool) -> Result { + Ok(TtsVoice { + id: info.Id()?.to_string_lossy(), + name: info.DisplayName()?.to_string_lossy(), + language: info.Language()?.to_string_lossy(), + // Windows lists voices that fail when actually trying to use them. This has been + // observed with voices from an uninstalled language pack. + // Validation is optional because it may be slow. + available: validate.then(|| synthesize_stream(&info, 1.0, "").is_ok()), + }) } diff --git a/rslib/src/lib.rs b/rslib/src/lib.rs index aa9330218..2360aa8f0 100644 --- a/rslib/src/lib.rs +++ b/rslib/src/lib.rs @@ -53,5 +53,3 @@ use lazy_static::lazy_static; lazy_static! { pub(crate) static ref PYTHON_UNIT_TESTS: bool = env::var("ANKI_TEST_MODE").is_ok(); } - -// temporary during proto migration