High level composition algorithms such as when_any and when_all need to be able to distinguish, in a generic manner, between success and failure of their subtasks. However, the case in which read or write returns [ec, n] when ec denotes failure, but n is equal to the requested amount of bytes to transfer, appears like an error to the generic observer, but is actually a success (and needs to be treated as one by high level compositions.)
For this reason, read and write need to be constrained to always return a successful ec when n equals buffer_size(buffers).
This also has implications for read_some and write_some, in terms of which read and write are implemented.
High level composition algorithms such as
when_anyandwhen_allneed to be able to distinguish, in a generic manner, between success and failure of their subtasks. However, the case in whichreadorwritereturns[ec, n]whenecdenotes failure, butnis equal to the requested amount of bytes to transfer, appears like an error to the generic observer, but is actually a success (and needs to be treated as one by high level compositions.)For this reason,
readandwriteneed to be constrained to always return a successfulecwhennequalsbuffer_size(buffers).This also has implications for
read_someandwrite_some, in terms of whichreadandwriteare implemented.