Skip to content

Revise tor_bytes::Writer::write to return a Result.

Nick Mathewson requested to merge nickm/arti:fallible_writers_v2 into main

With the presence of EncodeError, it (possibly) makes sense for all of our write methods to become fallible. This branch makes the Writeable::write function return an error, and then propagates that change through the rest of Arti.

Closes #513 (closed).

I'd like signoff from @eta and @Diziet on this API change; I'm not sure if I should instead be creating a TryWrite trait, and converting only some of the write() implementations to fallible. The downside to that alternative would be the possibility of needing to shift back and forth from Write to TryWrite later on based on object internals.

This branch is a fairly large leap of faith in the compiler's ability to inline code and remove dead code.

Merge request reports