Skip to content
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

Changed ticks function from &mut self to &self. #1033

Merged
merged 2 commits into from Sep 30, 2020

Conversation

aneilmac
Copy link
Contributor

@aneilmac aneilmac commented Sep 29, 2020

Hi there,

Currently, the ticks method requires a &mut self, which this PR downgrades to a &self.

Please let me know if I've made a mistake in my understanding here. I think &self should be fairly benign; AFAIK ticks doesn't do anything mutable under the hood.

What motivated this change is I can't check the elapsed ticks while I have a living Timer object due to the borrow checker. If I have missed a good reason this function is marked as mutable then please let me know.

@Cobrand
Copy link
Member

Cobrand commented Sep 30, 2020

I think you're safe with changing that to a &self. You are probably the only one to use this though, since std::time::Duration exists and is much more widely used in Rust. Still, thanks!

@Cobrand Cobrand merged commit ed46532 into Rust-SDL2:master Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants