FtpStream::retr is very useful, because it allows parsing streaming data from the server and, at the same time, it automatically handles FTP response statuses.
However, there is a major issue related to the error type of the inner function: if you need to perform non-trivial parsing of the remote data, you will end up with a richer set of errors, making FtpStream::retr unusable because FtpError cannot encapsulate all the possible errors anymore.
I propose to change the return type from Result<T, FtpError> to Result<T, E> where E: From<FtpError>. If you like the idea, I will be glad to send you a PR.
FtpStream::retr is very useful, because it allows parsing streaming data from the server and, at the same time, it automatically handles FTP response statuses.
However, there is a major issue related to the error type of the inner function: if you need to perform non-trivial parsing of the remote data, you will end up with a richer set of errors, making
FtpStream::retr
unusable becauseFtpError
cannot encapsulate all the possible errors anymore.I propose to change the return type from
Result<T, FtpError>
toResult<T, E> where E: From<FtpError>
. If you like the idea, I will be glad to send you a PR.