From b238c8c9382877c9e8756d021be5f2f6de69c3cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Caddet?= Date: Sat, 5 Sep 2020 11:30:11 +0200 Subject: [PATCH] fix return type of AVSpeechSynthesisVoice:new --- src/backends/av_foundation/voices.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/backends/av_foundation/voices.rs b/src/backends/av_foundation/voices.rs index 1f5b1d5..14e7974 100644 --- a/src/backends/av_foundation/voices.rs +++ b/src/backends/av_foundation/voices.rs @@ -11,10 +11,12 @@ pub struct AVSpeechSynthesisVoice(*const Object); impl AVSpeechSynthesisVoice { pub fn new(identifier: &str) -> Self { + let voice: *const Object; unsafe{ let i: id = NSString::alloc(nil).init_str(identifier); - msg_send![class!(AVSpeechSynthesisVoice), voiceWithIdentifier:i] - } + voice = msg_send![class!(AVSpeechSynthesisVoice), voiceWithIdentifier:i]; + }; + AVSpeechSynthesisVoice{0:voice} } pub fn default() -> Self { @@ -24,7 +26,7 @@ impl AVSpeechSynthesisVoice { pub fn list() -> Vec { let voices: CFArray = unsafe{msg_send![class!(AVSpeechSynthesisVoice), speechVoices]}; voices.iter().map(|v| { - AVSpeechSynthesisVoice{0: *v as *mut Object} + AVSpeechSynthesisVoice{0: *v as *const Object} }).collect() }