Rust-SDL2 / rust-sdl2

SDL2 bindings for Rust
MIT License
2.65k stars 465 forks source link

Replace From implementation of SwapInterval that could panic with TryFrom #1413

Open antonilol opened 4 days ago

antonilol commented 4 days ago

fixes #1311

Unfortunately this is a breaking change, Rust automatically implements TryFrom for types that implement From, so just adding the TryFrom implementation will not work.

Cobrand commented 2 days ago

Doesn't seem a very useful breaking change to remove the From, although there is value is adding TryFrom. Could you please re-add From to call TryFrom?

antonilol commented 1 day ago

I can't, (see first comment), all From implementations come with a TryFrom implementation (same conversion, always returning Ok and Error is set to Infallible (empty type)), so they can't coexist (see https://doc.rust-lang.org/src/core/convert/mod.rs.html#802-815)