From ddfc26227830c36c06c1976b15fc7e4fd4f9eb7d Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Wed, 2 Sep 2020 17:49:37 -0500 Subject: [PATCH] We do, in fact, seem to need 0.9.0-preview.0. This resolves the previously-noticed bindgen issue, where gdnative and speech-dispatcher require conflicting versions. The early iOS build failures appear due to attempting to link AppKit on iOS, where it doesn't exist. This seemed to work on Rust 1.45, but now fails on 1.46. Hopefully, this plus tts-rs changes get this building under iOS again. --- Cargo.toml | 2 +- src/lib.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 71dad95..c6dfd7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ crate-type = ["staticlib", "cdylib"] [dependencies] env_logger = "0.7" -gdnative = "0.8" +gdnative = "0.9.0-preview.0" tts = "0.6" [target.'cfg(windows)'.dependencies] diff --git a/src/lib.rs b/src/lib.rs index 47f111b..9f172fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ -use gdnative::init::*; -use gdnative::*; +use gdnative::prelude::*; use tts::{Features, TTS as Tts}; #[derive(NativeClass)] @@ -9,7 +8,7 @@ struct TTS(Tts); #[methods] impl TTS { - fn _init(_owner: gdnative::Node) -> Self { + fn new(_owner: &Node) -> Self { let tts = Tts::default().unwrap(); Self(tts) } @@ -122,18 +121,18 @@ impl TTS { } #[export] - fn speak(&mut self, _owner: Node, message: GodotString, interrupt: bool) { + fn speak(&mut self, _owner: &Node, message: GodotString, interrupt: bool) { let message = message.to_string(); self.0.speak(message, interrupt).unwrap(); } #[export] - fn stop(&mut self, _owner: Node) { + fn stop(&mut self, _owner: &Node) { self.0.stop().unwrap(); } #[export] - fn is_rate_supported(&mut self, _owner: Node) -> bool { + fn is_rate_supported(&mut self, _owner: &Node) -> bool { let Features { rate: rate_supported, .. @@ -142,7 +141,7 @@ impl TTS { } } -fn init(handle: gdnative::init::InitHandle) { +fn init(handle: InitHandle) { env_logger::init(); handle.add_class::(); }