From 7a84ce3d70a2dade0f29ce8b691722152c2ffa23 Mon Sep 17 00:00:00 2001 From: Fenrir Date: Thu, 22 Feb 2024 19:17:14 -0700 Subject: [PATCH] Use `move` closures in filter callback examples Trying to capture values by ref won't work for anything that's not `'static` --- ctru-rs/examples/software-keyboard.rs | 2 +- ctru-rs/src/applets/swkbd.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ctru-rs/examples/software-keyboard.rs b/ctru-rs/examples/software-keyboard.rs index 144b587..40635de 100644 --- a/ctru-rs/examples/software-keyboard.rs +++ b/ctru-rs/examples/software-keyboard.rs @@ -19,7 +19,7 @@ fn main() { // Custom filter callback to handle the given input. // Using this callback it's possible to integrate the applet // with custom error messages when the input is incorrect. - keyboard.set_filter_callback(Some(Box::new(|str| { + keyboard.set_filter_callback(Some(Box::new(move |str| { if str.contains("boo") { return (CallbackResult::Retry, Some("Ah, you scared me!".into())); } diff --git a/ctru-rs/src/applets/swkbd.rs b/ctru-rs/src/applets/swkbd.rs index 69b6f98..c5f386c 100644 --- a/ctru-rs/src/applets/swkbd.rs +++ b/ctru-rs/src/applets/swkbd.rs @@ -348,7 +348,7 @@ impl SoftwareKeyboard { /// /// let mut keyboard = SoftwareKeyboard::default(); /// - /// keyboard.set_filter_callback(Some(Box::new(|str| { + /// keyboard.set_filter_callback(Some(Box::new(move |str| { /// if str.contains("boo") { /// return (CallbackResult::Retry, Some("Ah, you scared me!".into())); /// }