The basic example of crate imap as of v2.4.1 shows a function fetch_inbox_top
that logs in to a mail server, fetches a message, logs out and returns a Result<_>
.
I don’t understand why the call to logout
is made explicitely because logout
is skipped if e.g. a message cannot be found and the function exits early, right?
- Why does Session not implement the
Drop
trait? - What would be the idiomatic/easiest/best way to ensure
logout
is called? Assuming that the function doesn’t panic (though the sample can) and always usesErr
in case of any error.