3 ms·
Cool article! Quick nitpick: the find example could return a reference to a static variable, and thus avoid both the heavy syntax and the leaked allocation: h
by PoignardAzur 2y ago
Cool article!
Quick nitpick: the find example could return a reference to a static variable, and thus avoid both the heavy syntax and the leaked allocation:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=90f8ac4e1b30141f3f0992c404cba473 https://play.rust-lang.org/?version=stable&mode=debug&editio...
- Arnavion 2y agoIt doesn't even need to be a `static`. It can be `const` or just inlined `&0` because borrows of consts get promoted to `'static`