rust-embedded / embedded-hal

A Hardware Abstraction Layer (HAL) for embedded systems
Apache License 2.0
2.01k stars 202 forks source link

Clarify write() may only return Ok(0) if data is empty #505

Closed adamgreig closed 1 year ago

adamgreig commented 1 year ago

Provisional fix for #501.

I'm not totally sure it makes sense to re-add WriteZero to ErrorKind since we're now using it for something a bit different to std, but since we do ask implementations to return an error instead of Ok(0), I guess that error should have a type.

Dirbaio commented 1 year ago

LGTM. We should also change the adapters to convert Ok(0) to an error.

adamgreig commented 1 year ago

Thanks for catching those points! I've updated the first commit and added a new one that updates the adaptors.