Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ApplyTcpOptionsErrorInternal
is superficial and can be replaced with aBox<>
, especially becausestd::error::Error::source()
returnsOption<&dyn std::error::Error>
. Identical approach is already used in std::io::Error, so familiarity bonus point here.Improvements in this PR
ApplyTcpOptionsErrorKind
andApplyTcpOptionsErrorInternal
.ApplyTcpOptionsErrorInternal
.Further thoughts
ApplyTcpOptionsError::new(.., ..)
is a bit verbose, mostly because of how types are called. I thought of droppingApplyTcpOptions
from error-related type names to avoid repeating the module name in it. However I didn't quite agree with myself that this is an improvement.tcp_options::*
are re-exported inlib.rs
, hard to say why this module gets a special treatment, but then I don't know much about the use cases here. Maybe the consumer of this library needs to set socket options frequently.There is a performance impact when using
Box
and dynamic dispatch. But this is negligible since error code paths should not be traversed frequently.This change is