-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Description
UdpSocket::set_read_timeout
UdpSocket::set_write_timeout
TcpStream::connect_timeout
TcpStream::set_read_timeout
TcpStream::set_write_timeout
UnixDatagram::set_read_timeout
UnixDatagram::set_write_timeout
UnixStream::set_read_timeout
UnixStream::set_write_timeout
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...
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.