-
Notifications
You must be signed in to change notification settings - Fork 0
fix[simulation] :: prevent infinite loops via input validation #15
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
Changes from all commits
bc2d69c
ef2cfe5
d481c55
fa84d5d
5c0817b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. keep going with the cargo test output for shoutout
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. concurred. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ready for merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While adding validation is a great improvement, silently returning on failure can make debugging difficult for the caller. It's not clear whether the simulation started or not, and if not, why.
Consider changing the function to return a
Resultto explicitly communicate success or failure. This is more idiomatic in Rust for functions that can fail.You could define a custom error enum like this:
Then, the function signature would become:
pub fn start_simulation(&self, time_step: f32, duration: f32) -> Result<(), SimulationStartError>And the implementation would change to:
This would provide clear feedback to the caller, allowing for proper error handling.