Draft: Handle binary responses in tor-dirclient by making DirResponse generic
This is one option to resolve #112 (closed) .
A Byte
wrapper type is added to allow for conversions between Vec<u8>
and String/Vec<u8>
using the TryFrom
trait.
Users of the download
function can specify the desired type. If the conversion fails the download
function will return an error.
Compared to the solution implemented in !46 (closed) the error handling in get_resource
and fetch_multiple
(in tor-dirmgr
) will still be triggered when the conversion fails. This relieves callers of get_resource
or fetch_multiple
of some error handling responsibility.
Edited by Robin Leander Schröder