Secret sauce that brings YouTube followers, views, likes
Get Free YouTube Subscribers, Views and Likes

Rust Functions Are Weird (But Be Glad)

Follow
Logan Smith

Rust takes a unique approach to function types, for both closures and fn items. In this video we'll talk about a way to fit these strange function types into your existing understanding of what types are. Then we'll look at how another language (okay, it's C++) does function types in a way that causes poor codegen in generic higherorder functions if you aren't carefuland how/why Rust avoids this problem.

Compiler Explorer https://godbolt.org/

Godbolt code samples from the video:
C++ https://godbolt.org/z/xo83Ecfqb
Rust https://rust.godbolt.org/z/E5fvaxWPM

Rust Stuff
fn pointers vs. fn items https://doc.rustlang.org/std/primiti...
Fn (the trait) https://doc.rustlang.org/std/ops/tra...

C++ Stuff
Decay https://en.cppreference.com/w/cpp/typ...
Boost.TypeIndex https://www.boost.org/doc/libs/1_82_0...
std::reduce https://en.cppreference.com/w/cpp/alg...
Ranges https://en.cppreference.com/w/cpp/ranges
static https://en.cppreference.com/w/cpp/lan...

I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity.
https://www.manim.community/
https://www.blender.org/
https://www.audacityteam.org/

posted by electryas