Closed rmja closed 1 year ago
an impl Write<Error=Infallible>
can still return 0 from write()
, which would cause a WriteAllError::WriteZero
. So the panics here are not unreachable.
I think it's not idiomatic for From
impls to panic. TryFrom
would be appropriate here, though that doesn't work with ?
which I guess is your goal.
Given the discussion on the previous wg meeting where I believe the consensus was to revert the introduction of the WriteAllError
type in favor of disallowing Ok(0)
from write()
, this PR gets superfluous.
This PR will allow io middleware to constrain their
Write
implementation to a restricted error type that can convert from the newWriteAllError
/WriteFmtError
types. One example is the proposal over here: https://github.com/rmja/buffered-io/blob/constrained-write-error/src/asynch/write.rs#L28-L30Specifically, it allows for easy use of e.g. Vec in tests which has the
Infallible
error type.For reference, see the discussions here:
And, please, let me know if there is anything obvious that I am missing that could easy the transition to handling these two new error types.
cc @lulf @Dirbaio @MabezDev