jonhoo / rust-imap

IMAP client library for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`fetch_uid` sends a FETCH even if the given uid_set is empty

mmirate opened this issue · comments

Such FETCH commands are syntactically invalid and the server will respond with, well, some kind of error—the exact behavior is probably server-dependent.

Since default/empty values of fetch_uid's precise return-type cannot be publicly constructed (i.e. as a user I cannot avoid calling fetch_uid on an empty uid list by instead simply mapping such lists to empty ZeroCopy<Vec<_>>s), I would instead have expected that fetch_uid itself would condition any nontrivial operation upon the nonemptiness of the given uid list.

(Tangentially, I'm mildly annoyed by the stringly-typed way that the uid set is input, contrasting the output from uid_search.)

Ah, that's an excellent point — I agree this should be fixed. Would you mind writing up a PR? It should be fairly simple I think.

As for the stringly-typed interface, that's mostly a leftover from a much earlier version of imap. Given that I'm planning a breaking release soon, if you want to take a stab at fixing, I'd be very open to reviewing! @mordak may also have thoughts on this given their recent work in #172.