For all of the APIs above, the docs have a line with this wording:
It is an error to pass the zero Duration to this method.
My initial thought is, what does "it is an error" mean? Does this mean the API will panic if Some(Duration::from_secs(0)) is passed or will it just return an Err? The answer appears to be the latter.
Also since it's the latter, and we don't have an explicit check for Duration(0) in our codebase, it means we're relying on the behavior being the same across all platforms. Is this alright? Should/can we add an explicit check for Duration(0)? Should we add a test ensuring this is the behavior across all platforms?
Maybe I'm overthinking this...
UdpSocket::set_read_timeoutUdpSocket::set_write_timeoutTcpStream::connect_timeoutTcpStream::set_read_timeoutTcpStream::set_write_timeoutUnixDatagram::set_read_timeoutUnixDatagram::set_write_timeoutUnixStream::set_read_timeoutUnixStream::set_write_timeoutFor all of the APIs above, the docs have a line with this wording:
My initial thought is, what does "it is an error" mean? Does this mean the API will panic if
Some(Duration::from_secs(0))is passed or will it just return anErr? The answer appears to be the latter.Also since it's the latter, and we don't have an explicit check for
Duration(0)in our codebase, it means we're relying on the behavior being the same across all platforms. Is this alright? Should/can we add an explicit check forDuration(0)? Should we add a test ensuring this is the behavior across all platforms?Maybe I'm overthinking this...