PolyMeilex / rfd

Rusty File Dialog
MIT License
524 stars 60 forks source link

`Send`/`Sync` `DialogFutureType` #200

Closed jnhyatt closed 3 weeks ago

jnhyatt commented 3 weeks ago

Trying to use async save_file and co. in a context that requires my futures to be Send and Sync and getting errors. Turns out the Future returned by save_file is already Send, but the signature of save_file only guarantees impl Future<...>. We can get the Send guarantee for free by specifying a specific type for the future returned by save_file (and I did the others for consistency).

The change I'm less certain on is adding Sync to DialogFutureType's inner boxed type. It all builds, so I don't think there's a problem with that (haven't tested on wasm) and I don't even think anything I did is a breaking change. If you have a suite of tests to put this through, though, that probably wouldn't be a bad idea.

PS Just looked and I don't think anything I did should affect wasm since DialogFutureType isn't Send on wasm, and I didn't add any trait bounds for that config. So unless I'm way more tired than I'm realizing, this PR shouldn't break anything! 🎉

jnhyatt commented 3 weeks ago

Investigating the CI failures. Added a changelog entry but apparently there's a future that's not sync in linux

jnhyatt commented 3 weeks ago

After some investigation, I found that adding sync bounds is not only non-trivial, it's probably totally unnecessary. Closing this out