Closures are widely used in Rust.
Let's create a function to use a closure, and also look at how the compiler inferences the type.
This is just a bit of a tea-break workout. Hope you find it useful.
Using a closure in a function makes my head hurt, but it's cool, no?
https://doc.rust-lang.org/reference/types/closure.html
Rust Playground Example :
------------------------------------------
✅ https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a7f430e7f85889e9aaa64c8d7c09ff86
#rustdevelopment #learningrust #rustlang