From 69b5c39f669131dd25b9df36a5bcf59b5b7574b7 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Wed, 30 Sep 2020 16:03:04 -0500 Subject: [PATCH] Eliminate Option in return. --- src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a6d92a7..3372327 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -174,7 +174,7 @@ impl TTS { } #[export] - fn speak(&mut self, _owner: &Node, message: GodotString, interrupt: bool) -> Option { + fn speak(&mut self, _owner: &Node, message: GodotString, interrupt: bool) -> Variant { let message = message.to_string(); if let Ok(id) = self.0.speak(message, interrupt) { let utterance: Instance = Instance::new(); @@ -183,9 +183,10 @@ impl TTS { .map_mut(|u, _| u.0 = id) .expect("Failed to set utterance ID"); } - Some(utterance.owned_to_variant()) + let utterance = utterance.owned_to_variant(); + utterance } else { - None + Variant::default() } }