-
Notifications
You must be signed in to change notification settings - Fork 100
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
Add the timeout flag #131
Add the timeout flag #131
Conversation
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.
Thanks for taking the time to implement this 😀. I have one comment regarding the validation
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.
Nice work!
src/main.rs
Outdated
let timeout = if let Some(timeout) = args.timeout { | ||
let timeout = timeout.as_duration(); | ||
if timeout == Duration::default() { | ||
None | ||
} else { | ||
Some(timeout) | ||
} | ||
} else { | ||
None | ||
}; |
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.
Maybe this logic could go inside as_duration()
, and that could return an Option<Duration>
instead?
let timeout = args | ||
.timeout | ||
.map(|t| t.as_duration()) | ||
.filter(|t| t != &Duration::from_nanos(0)); |
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.
Nice improvement!
I still think it would make a bit more sense to have this inside as_duration()
but it doesn't really matter.
Change the newline of |
@sorairolake would you like to implement the optional changes requested by @blyxxyz before we merge this? Edit: On second thought, I think this could be done outside of this PR |
See: #4