Войти
  • 197459Просмотров
  • 2 года назадОпубликованоLogan Smith

Rust Functions Are Weird (But Be Glad)

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 higher-order functions if you aren't careful--and how/why Rust avoids this problem. Compiler Explorer - Godbolt code samples from the video: C++ - Rust - *Rust Stuff* fn pointers vs. fn items - #creating-function-pointers Fn (the trait) - *C++ Stuff* Decay - - std::reduce - Ranges - static - I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity.