2 ms·
Fn can only be called concurrently if its environment is Sync, which is often true but not necessarily. It’s more precise to say that Fn can be called even whe
by School-Cotton 9mo ago
Fn can only be called concurrently if its environment is Sync, which is often true but not necessarily.
It’s more precise to say that Fn can be called even when you only have shared access to it, which is a necessary, but not sufficient, condition for being able to be called concurrently.
- pwdisswordfishy 9mo agoI'm not sure myself, does Fn correspond to reentrancy or is there some detail I am missing?
- armchairhacker 9mo ago`Fn`, `FnMut`, and `FnOnce` can also implement and not implement `Sync` (also `Send`, `Clone`, `Copy`, lifetime bounds, and I think `use<...>` applies to `impl Fn...` return types). EDIT: https://news.ycombinator.com/item?id=46750011 https://news.ycombinator.com/item?id=46750011 also mentioned `AsyncFn`, `AsyncFnMut`, and `AsyncFnOnce`.