Simplify fetch a little

This commit is contained in:
Jon Gjengset 2018-11-22 14:03:29 -05:00
parent 5dd9dfe469
commit fc935bf884
No known key found for this signature in database
GPG key ID: D64AC9D67176DC71

View file

@ -422,21 +422,19 @@ impl<T: Read + Write> Session<T> {
/// ///
/// - `ALL`: equivalent to: `(FLAGS INTERNALDATE RFC822.SIZE ENVELOPE)` /// - `ALL`: equivalent to: `(FLAGS INTERNALDATE RFC822.SIZE ENVELOPE)`
/// - `FAST`: equivalent to: `(FLAGS INTERNALDATE RFC822.SIZE)` /// - `FAST`: equivalent to: `(FLAGS INTERNALDATE RFC822.SIZE)`
/// - `FULL`: equivalent to: `(FLAGS INTERNALDATE RFC822.SIZE ENVELOPE BODY)`
/// ///
/// The currently defined data items that can be fetched are listen [in the /// The currently defined data items that can be fetched are listen [in the
/// RFC](https://tools.ietf.org/html/rfc3501#section-6.4.5), but here are some common ones: /// RFC](https://tools.ietf.org/html/rfc3501#section-6.4.5), but here are some common ones:
/// ///
/// - `FLAGS`: The flags that are set for this message. /// - `FLAGS`: The flags that are set for this message.
/// - `INTERNALDATE`: The internal date of the message. /// - `INTERNALDATE`: The internal date of the message.
/// - `BODY`: Non-extensible form of BODYSTRUCTURE.
/// - `BODY[<section>]`: /// - `BODY[<section>]`:
/// ///
/// The text of a particular body section. The section specification is a set of zero or /// The text of a particular body section. The section specification is a set of zero or
/// more part specifiers delimited by periods. A part specifier is either a part number /// more part specifiers delimited by periods. A part specifier is either a part number
/// (see RFC) or one of the following: `HEADER`, `HEADER.FIELDS`, `HEADER.FIELDS.NOT`, /// (see RFC) or one of the following: `HEADER`, `HEADER.FIELDS`, `HEADER.FIELDS.NOT`,
/// `MIME`, and `TEXT`. An empty section specification refers to the entire message, /// `MIME`, and `TEXT`. An empty section specification (i.e., `BODY[]`) refers to the
/// including the header. /// entire message, including the header.
/// ///
/// The `HEADER`, `HEADER.FIELDS`, and `HEADER.FIELDS.NOT` part specifiers refer to the /// The `HEADER`, `HEADER.FIELDS`, and `HEADER.FIELDS.NOT` part specifiers refer to the
/// [RFC-2822](https://tools.ietf.org/html/rfc2822) header of the message or of an /// [RFC-2822](https://tools.ietf.org/html/rfc2822) header of the message or of an
@ -462,18 +460,12 @@ impl<T: Read + Write> Session<T> {
/// change, they will generally be included as part of the `FETCH` responses. /// change, they will generally be included as part of the `FETCH` responses.
/// - `BODY.PEEK[<section>]`: An alternate form of `BODY[<section>]` that does not implicitly /// - `BODY.PEEK[<section>]`: An alternate form of `BODY[<section>]` that does not implicitly
/// set [`Flag::Seen`]. /// set [`Flag::Seen`].
/// - `BODYSTRUCTURE`: The [MIME-IMB](https://tools.ietf.org/html/rfc2045) body structure of
/// the message. This is computed by the server by parsing the
/// [MIME-IMB](https://tools.ietf.org/html/rfc2045) header fields in the [RFC-2822] header
/// and [MIME-IMB](https://tools.ietf.org/html/rfc2045) headers.
/// - `ENVELOPE`: The envelope structure of the message. This is computed by the server by /// - `ENVELOPE`: The envelope structure of the message. This is computed by the server by
/// parsing the [RFC-2822](https://tools.ietf.org/html/rfc2822) header into the component /// parsing the [RFC-2822](https://tools.ietf.org/html/rfc2822) header into the component
/// parts, defaulting various fields as necessary. /// parts, defaulting various fields as necessary.
/// - `RFC822`: Functionally equivalent to `BODY[]`. /// - `RFC822`: Functionally equivalent to `BODY[]`.
/// - `RFC822.HEADER`: Functionally equivalent to `BODY.PEEK[HEADER]`. /// - `RFC822.HEADER`: Functionally equivalent to `BODY.PEEK[HEADER]`.
/// - `RFC822.SIZE`: The [RFC-2822](https://tools.ietf.org/html/rfc2822) size of the message. /// - `RFC822.SIZE`: The [RFC-2822](https://tools.ietf.org/html/rfc2822) size of the message.
/// - `RFC822.TEXT`: Functionally equivalent to `BODY[TEXT]`, differing in the syntax
/// of the resulting untagged FETCH data (RFC822.TEXT is returned).
/// - `UID`: The unique identifier for the message. /// - `UID`: The unique identifier for the message.
pub fn fetch(&mut self, sequence_set: &str, query: &str) -> ZeroCopyResult<Vec<Fetch>> { pub fn fetch(&mut self, sequence_set: &str, query: &str) -> ZeroCopyResult<Vec<Fetch>> {
self.run_command_and_read_response(&format!("FETCH {} {}", sequence_set, query)) self.run_command_and_read_response(&format!("FETCH {} {}", sequence_set, query))