this post was submitted on 01 Sep 2023
16 points (86.4% liked)

Rust

5999 readers
23 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] anton@lemmy.blahaj.zone 1 points 10 months ago

Such a case would be the single function having a side effect*. This allows the caller to chose when to execute the side effect or to drop the result without executing it.

In my opinion that is fine with fn_once but not into because of the implicit contract of these traits.

* = I'm counting expensive computation, but not allocation and memcopy as a side effect in this comment.