-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve filter callback API redux #163
Conversation
806851d
to
9ed5878
Compare
It's kinda pointless to have those checks *after* attempting to deref the data rather than before.
Trying to capture values by ref won't work for anything that's not `'static`
f657a94
to
7a84ce3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! A great shaving of wrapper code around libctru
thanks to an up-close implementation. The API feels much better now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too!
keyboard.set_filter_callback(Some(Box::new(move |str| { | ||
if str.contains("boo") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, just realized I'm surprised there's no lint for shadowing builtin str
, but I guess shadowing in general is not linted for so idk
Now that our code is in control of calling the software keyboard, we can switch away from using
CString
s in the filter callback without incurring extra allocations. Plus there's a lot of room to simplify the implementation overall, which I've been able to do here too.