-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renderer.fill_rect now takes an Option<Rect>. #561
Renderer.fill_rect now takes an Option<Rect>. #561
Conversation
Luckily for us Technically I guess If you could confirm that this change doesn't break current usage of |
The difference is that
There's no implicit conversion from So I'd imagine this is indeed a breaking change. |
Hold on, I got you now. I'll implement the fill_rect function taking an |
Nah, I mean that few rust releases ago this PR has made its way into the language : rust-lang/rust#34828 See here That means that you should not have to implement anything, it is already in the language. However I'd like to know if this really works or not right now with our code (it should be, but we can never be too sure) |
Sorry technically you just have to change one line, which is pub fn fill_rect(&mut self, rect: Option<Rect>) -> Result<(), String> { into pub fn fill_rect<T:Into<Option<Rect>>(&mut self, rect: T) -> Result<(), String> {
let rect = rect.into() edit: just realized that's exactly what you said, so this is useless |
This should allow passing Rect, Some(Rect) or None to fill_rect. Passing None to fill_rect fills the entire rendering target.
d8bfd0f
to
9974063
Compare
Yep, that's exactly what I just realized. :) Thanks anyway for the clarification. |
Cheers ! |
Native SDL2 behavior allows passing of null to fill the entire target.
Unless there's some reasoning not to allow this?