melib: add clippy::doc_markdown

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/359/head
Manos Pitsidianakis 3 months ago
parent 30a3205e4f
commit c7aee72525
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -502,7 +502,7 @@ pub trait BackendOp: ::std::fmt::Debug + ::std::marker::Send {
fn as_bytes(&mut self) -> ResultFuture<Vec<u8>>; fn as_bytes(&mut self) -> ResultFuture<Vec<u8>>;
} }
/// Wrapper for BackendOps that are to be set read-only. /// Wrapper for [`BackendOp`] that are to be set read-only.
/// ///
/// Warning: Backend implementations may still cause side-effects (for example /// Warning: Backend implementations may still cause side-effects (for example
/// IMAP can set the Seen flag when fetching an envelope) /// IMAP can set the Seen flag when fetching an envelope)

@ -20,7 +20,7 @@
*/ */
//! Email addresses. Parsing functions are in //! Email addresses. Parsing functions are in
//! [melib::email::parser::address](super::parser::address). //! [`crate::email::parser::address`].
use std::{ use std::{
collections::HashSet, collections::HashSet,
convert::TryFrom, convert::TryFrom,

@ -134,7 +134,7 @@ impl AttachmentBuilder {
/// Set body to the entire raw contents, use this if raw contains only data /// Set body to the entire raw contents, use this if raw contains only data
/// and no headers If raw contains data and headers pass it through /// and no headers If raw contains data and headers pass it through
/// AttachmentBuilder::new(). /// [`AttachmentBuilder::new`].
pub fn set_body_to_raw(&mut self) -> &mut Self { pub fn set_body_to_raw(&mut self) -> &mut Self {
self.body = StrBuilder { self.body = StrBuilder {
offset: 0, offset: 0,

@ -19,7 +19,7 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>. * along with meli. If not, see <http://www.gnu.org/licenses/>.
*/ */
//! Compose a [``Draft`], with `MIME` and attachment support. //! Compose a [`Draft`], with `MIME` and attachment support.
use std::{ use std::{
convert::TryFrom, convert::TryFrom,
ffi::OsStr, ffi::OsStr,
@ -542,7 +542,7 @@ fn print_attachment(ret: &mut String, a: AttachmentBuilder) {
} }
/// Reads file from given path, and returns an 'application/octet-stream' /// Reads file from given path, and returns an 'application/octet-stream'
/// AttachmentBuilder object /// [`AttachmentBuilder`] object
pub fn attachment_from_file<I>(path: &I) -> Result<AttachmentBuilder> pub fn attachment_from_file<I>(path: &I) -> Result<AttachmentBuilder>
where where
I: AsRef<OsStr>, I: AsRef<OsStr>,

@ -76,7 +76,7 @@ impl<'a> Borrow<dyn HeaderKey + 'a> for HeaderName {
/// - `usize` /// - `usize`
/// - `&[u8]`, which panics if it's not a valid header value. /// - `&[u8]`, which panics if it's not a valid header value.
/// - `&str`, which also panics if it's not a valid header value. /// - `&str`, which also panics if it's not a valid header value.
/// - [HeaderName], which is guaranteed to be valid. /// - [`HeaderName`], which is guaranteed to be valid.
/// ///
/// # Panics /// # Panics
/// ///

@ -1402,10 +1402,12 @@ pub mod generic {
Ok((input, ret.into())) Ok((input, ret.into()))
} }
///`atext = ALPHA / DIGIT / ; Printable US-ASCII "!" / "#" / ///```text
/// atext = ALPHA / DIGIT / ; Printable US-ASCII "!" / "#" /
/// ; characters not including "$" / "%" / ; specials. Used for /// ; characters not including "$" / "%" / ; specials. Used for
/// atoms. "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" /// atoms. "&" / "'" / "*" / "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`"
/// / "{" / "|" / "}" / "~"` /// / "{" / "|" / "}" / "~"
/// ```
pub fn atext_ascii(input: &[u8]) -> IResult<&[u8], Cow<'_, [u8]>> { pub fn atext_ascii(input: &[u8]) -> IResult<&[u8], Cow<'_, [u8]>> {
if input.is_empty() { if input.is_empty() {
return Err(nom::Err::Error((input, "atext(): empty input").into())); return Err(nom::Err::Error((input, "atext(): empty input").into()));

@ -19,7 +19,7 @@
* along with meli. If not, see <http://www.gnu.org/licenses/>. * along with meli. If not, see <http://www.gnu.org/licenses/>.
*/ */
//! Verification of OpenPGP signatures. //! Verification of `OpenPGP` signatures.
use crate::{ use crate::{
email::{ email::{
attachment_types::{ContentType, MultipartType}, attachment_types::{ContentType, MultipartType},

@ -79,7 +79,7 @@ impl ImapConnection {
} }
} }
/// > rfc4549_Synchronization_Operations_for_Disconnected_IMAP4_Clients /// RFC4549 Synchronization Operations for Disconnected IMAP4 Clients
pub async fn resync_basic( pub async fn resync_basic(
&mut self, &mut self,
mut cache_handle: Box<dyn ImapCache>, mut cache_handle: Box<dyn ImapCache>,
@ -311,7 +311,7 @@ impl ImapConnection {
Ok(Some(payload.into_iter().map(|(_, env)| env).collect())) Ok(Some(payload.into_iter().map(|(_, env)| env).collect()))
} }
/// > rfc4549_Synchronization_Operations_for_Disconnected_IMAP4_Clients /// RFC4549 Synchronization Operations for Disconnected IMAP4 Clients
/// > Section 6.1 /// > Section 6.1
pub async fn resync_condstore( pub async fn resync_condstore(
&mut self, &mut self,
@ -621,9 +621,8 @@ impl ImapConnection {
Ok(Some(payload.into_iter().map(|(_, env)| env).collect())) Ok(Some(payload.into_iter().map(|(_, env)| env).collect()))
} }
/// > rfc7162_Quick Flag Changes Resynchronization (CONDSTORE)_and Quick /// RFC7162 Quick Flag Changes Resynchronization (CONDSTORE) and Quick
/// > Mailbox /// Mailbox Resynchronization (QRESYNC)
/// > Resynchronization (QRESYNC)
pub async fn resync_condstoreqresync( pub async fn resync_condstoreqresync(
&mut self, &mut self,
_cache_handle: Box<dyn ImapCache>, _cache_handle: Box<dyn ImapCache>,

@ -99,7 +99,7 @@ impl Method<MailboxObject> for MailboxGet {
/// Section 5.3 but with the following additional request argument: /// Section 5.3 but with the following additional request argument:
/// ///
/// ///
/// The following extra SetError types are defined: /// The following extra [`SetError`] types are defined:
/// ///
/// For `destroy`: /// For `destroy`:
/// ///

@ -60,9 +60,9 @@ pub enum UndoStatus {
/// This represents the delivery status for each of the submission's /// This represents the delivery status for each of the submission's
/// recipients, if known. This property MAY not be supported by all /// recipients, if known. This property MAY not be supported by all
/// servers, in which case it will remain null. Servers that support /// servers, in which case it will remain null. Servers that support
/// it SHOULD update the EmailSubmission object each time the status /// it SHOULD update the [`EmailSubmission`](`EmailSubmissionObject`) object
/// of any of the recipients changes, even if some recipients are /// each time the status of any of the recipients changes, even if some
/// still being retried. /// recipients are still being retried.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct DeliveryStatusObject { pub struct DeliveryStatusObject {
@ -175,7 +175,7 @@ pub enum Delivered {
/// # Email Submission /// # Email Submission
/// ///
/// An *EmailSubmission* object represents the submission of an Email for /// An `EmailSubmission` object represents the submission of an Email for
/// delivery to one or more recipients. It has the following properties: /// delivery to one or more recipients. It has the following properties:
#[derive(Clone, Debug, Deserialize)] #[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
@ -299,11 +299,11 @@ pub struct EmailSubmissionSet {
#[serde(default)] #[serde(default)]
pub on_success_update_email: Option<IndexMap<Id<EmailSubmissionObject>, PatchObject>>, pub on_success_update_email: Option<IndexMap<Id<EmailSubmissionObject>, PatchObject>>,
/// onSuccessDestroyEmail: `Id[]|null` /// onSuccessDestroyEmail: `Id[]|null`
/// A list of EmailSubmission ids for which the Email with the /// A list of [`EmailSubmissionObject`] ids for which the Email with the
/// corresponding `emailId` should be destroyed if the create/update/ /// corresponding `emailId` should be destroyed if the create/update/
/// destroy succeeds. (For references to EmailSubmission creations, /// destroy succeeds. (For references to [`EmailSubmissionObject`]
/// this is equivalent to a creation-reference, so the id will be the /// creations, this is equivalent to a creation-reference, so the id
/// creation id prefixed with a `#`.) /// will be the creation id prefixed with a `#`.)
#[serde(default)] #[serde(default)]
pub on_success_destroy_email: Option<Vec<Id<EmailSubmissionObject>>>, pub on_success_destroy_email: Option<Vec<Id<EmailSubmissionObject>>>,
} }
@ -353,9 +353,9 @@ pub struct EnvelopeObject {
/// When a JMAP server performs an SMTP message submission, it MAY /// When a JMAP server performs an SMTP message submission, it MAY
/// use the same id string for the ENVID parameter `[RFC3461]` and /// use the same id string for the ENVID parameter `[RFC3461]` and
/// the EmailSubmission object id. Servers that do this MAY /// the [`EmailSubmission`](`EmailSubmissionObject`) object id. Servers
/// replace a client-provided value for ENVID with a server- /// that do this MAY replace a client-provided value for ENVID with a
/// provided value. /// server- provided value.
pub mail_from: Address, pub mail_from: Address,
/// The email addresses to send the message to, and any RCPT TO /// The email addresses to send the message to, and any RCPT TO

@ -41,6 +41,8 @@
//clippy::cast_possible_wrap, //clippy::cast_possible_wrap,
//clippy::ptr_as_ptr, //clippy::ptr_as_ptr,
//clippy::bool_to_int_with_if, //clippy::bool_to_int_with_if,
clippy::doc_markdown,
clippy::expect_fun_call,
clippy::borrow_as_ptr, clippy::borrow_as_ptr,
clippy::case_sensitive_file_extension_comparisons, clippy::case_sensitive_file_extension_comparisons,
//clippy::cast_lossless, //clippy::cast_lossless,

@ -72,7 +72,7 @@
//! //!
//! ## Metadata //! ## Metadata
//! //!
//! `melib` recognizes the CClient (a [Pine client API](https://web.archive.org/web/20050203003235/http://www.washington.edu/imap/)) convention for metadata in `mbox` format: //! `melib` recognizes the `CClient` (a [Pine client API](https://web.archive.org/web/20050203003235/http://www.washington.edu/imap/)) convention for metadata in `mbox` format:
//! //!
//! - `Status`: R (Seen) and O (non-Recent) flags //! - `Status`: R (Seen) and O (non-Recent) flags
//! - `X-Status`: A (Answered), F (Flagged), T (Draft) and D (Deleted) flags //! - `X-Status`: A (Answered), F (Flagged), T (Draft) and D (Deleted) flags

@ -1,5 +1,6 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)] #![allow(non_upper_case_globals)]
#![allow(clippy::doc_markdown)]
use libc::time_t; use libc::time_t;
/* automatically generated by rust-bindgen */ /* automatically generated by rust-bindgen */
@ -8,12 +9,12 @@ pub type __syscall_slong_t = ::std::os::raw::c_long;
/// Notmuch boolean type. /// Notmuch boolean type.
pub type notmuch_bool_t = ::std::os::raw::c_int; pub type notmuch_bool_t = ::std::os::raw::c_int;
/// No error occurred. /// No error occurred.
pub const _notmuch_status_NOTMUCH_STATUS_SUCCESS: _notmuch_status = 0; pub const NOTMUCH_STATUS_SUCCESS: _notmuch_status = 0;
/// Out of memory. /// Out of memory.
pub const _notmuch_status_NOTMUCH_STATUS_OUT_OF_MEMORY: _notmuch_status = 1; pub const NOTMUCH_STATUS_OUT_OF_MEMORY: _notmuch_status = 1;
/// An attempt was made to write to a database opened in read-only /// An attempt was made to write to a database opened in read-only
/// mode. /// mode.
pub const _notmuch_status_NOTMUCH_STATUS_READ_ONLY_DATABASE: _notmuch_status = 2; pub const NOTMUCH_STATUS_READ_ONLY_DATABASE: _notmuch_status = 2;
/// A Xapian exception occurred. /// A Xapian exception occurred.
/// ///
/// ```text /// ```text
@ -21,54 +22,54 @@ pub const _notmuch_status_NOTMUCH_STATUS_READ_ONLY_DATABASE: _notmuch_status = 2
/// value. Instead we should map to things like DATABASE_LOCKED or /// value. Instead we should map to things like DATABASE_LOCKED or
/// whatever. /// whatever.
/// ``` /// ```
pub const _notmuch_status_NOTMUCH_STATUS_XAPIAN_EXCEPTION: _notmuch_status = 3; pub const NOTMUCH_STATUS_XAPIAN_EXCEPTION: _notmuch_status = 3;
/// An error occurred trying to read or write to a file (this could /// An error occurred trying to read or write to a file (this could
/// be file not found, permission denied, etc.) /// be file not found, permission denied, etc.)
pub const _notmuch_status_NOTMUCH_STATUS_FILE_ERROR: _notmuch_status = 4; pub const NOTMUCH_STATUS_FILE_ERROR: _notmuch_status = 4;
/// A file was presented that doesn't appear to be an email /// A file was presented that doesn't appear to be an email
/// message. /// message.
pub const _notmuch_status_NOTMUCH_STATUS_FILE_NOT_EMAIL: _notmuch_status = 5; pub const NOTMUCH_STATUS_FILE_NOT_EMAIL: _notmuch_status = 5;
/// A file contains a message ID that is identical to a message /// A file contains a message ID that is identical to a message
/// already in the database. /// already in the database.
pub const _notmuch_status_NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: _notmuch_status = 6; pub const NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: _notmuch_status = 6;
/// The user erroneously passed a NULL pointer to a notmuch /// The user erroneously passed a NULL pointer to a notmuch
/// function. /// function.
pub const _notmuch_status_NOTMUCH_STATUS_NULL_POINTER: _notmuch_status = 7; pub const NOTMUCH_STATUS_NULL_POINTER: _notmuch_status = 7;
/// A tag value is too long (exceeds NOTMUCH_TAG_MAX). /// A tag value is too long (exceeds NOTMUCH_TAG_MAX).
pub const _notmuch_status_NOTMUCH_STATUS_TAG_TOO_LONG: _notmuch_status = 8; pub const NOTMUCH_STATUS_TAG_TOO_LONG: _notmuch_status = 8;
/// The notmuch_message_thaw function has been called more times /// The notmuch_message_thaw function has been called more times
/// than notmuch_message_freeze. /// than notmuch_message_freeze.
pub const _notmuch_status_NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: _notmuch_status = 9; pub const NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW: _notmuch_status = 9;
/// notmuch_database_end_atomic has been called more times than /// notmuch_database_end_atomic has been called more times than
/// notmuch_database_begin_atomic. /// notmuch_database_begin_atomic.
pub const _notmuch_status_NOTMUCH_STATUS_UNBALANCED_ATOMIC: _notmuch_status = 10; pub const NOTMUCH_STATUS_UNBALANCED_ATOMIC: _notmuch_status = 10;
/// The operation is not supported. /// The operation is not supported.
pub const _notmuch_status_NOTMUCH_STATUS_UNSUPPORTED_OPERATION: _notmuch_status = 11; pub const NOTMUCH_STATUS_UNSUPPORTED_OPERATION: _notmuch_status = 11;
/// The operation requires a database upgrade. /// The operation requires a database upgrade.
pub const _notmuch_status_NOTMUCH_STATUS_UPGRADE_REQUIRED: _notmuch_status = 12; pub const NOTMUCH_STATUS_UPGRADE_REQUIRED: _notmuch_status = 12;
/// There is a problem with the proposed path, e.g. a relative path /// There is a problem with the proposed path, e.g. a relative path
/// passed to a function expecting an absolute path. /// passed to a function expecting an absolute path.
pub const _notmuch_status_NOTMUCH_STATUS_PATH_ERROR: _notmuch_status = 13; pub const NOTMUCH_STATUS_PATH_ERROR: _notmuch_status = 13;
/// The requested operation was ignored. Depending on the function, /// The requested operation was ignored. Depending on the function,
/// this may not be an actual error. /// this may not be an actual error.
pub const _notmuch_status_NOTMUCH_STATUS_IGNORED: _notmuch_status = 14; pub const NOTMUCH_STATUS_IGNORED: _notmuch_status = 14;
/// One of the arguments violates the preconditions for the /// One of the arguments violates the preconditions for the
/// function, in a way not covered by a more specific argument. /// function, in a way not covered by a more specific argument.
pub const _notmuch_status_NOTMUCH_STATUS_ILLEGAL_ARGUMENT: _notmuch_status = 15; pub const NOTMUCH_STATUS_ILLEGAL_ARGUMENT: _notmuch_status = 15;
/// A MIME object claimed to have cryptographic protection which /// A MIME object claimed to have cryptographic protection which
/// notmuch tried to handle, but the protocol was not specified in /// notmuch tried to handle, but the protocol was not specified in
/// an intelligible way. /// an intelligible way.
pub const _notmuch_status_NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL: _notmuch_status = 16; pub const NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL: _notmuch_status = 16;
/// Notmuch attempted to do crypto processing, but could not /// Notmuch attempted to do crypto processing, but could not
/// initialize the engine needed to do so. /// initialize the engine needed to do so.
pub const _notmuch_status_NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION: _notmuch_status = 17; pub const NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION: _notmuch_status = 17;
/// A MIME object claimed to have cryptographic protection, and /// A MIME object claimed to have cryptographic protection, and
/// notmuch attempted to process it, but the specific protocol was /// notmuch attempted to process it, but the specific protocol was
/// something that notmuch doesn't know how to handle. /// something that notmuch doesn't know how to handle.
pub const _notmuch_status_NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL: _notmuch_status = 18; pub const NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL: _notmuch_status = 18;
/// Not an actual status value. Just a way to find out how many /// Not an actual status value. Just a way to find out how many
/// valid status values there are. /// valid status values there are.
pub const _notmuch_status_NOTMUCH_STATUS_LAST_STATUS: _notmuch_status = 19; pub const NOTMUCH_STATUS_LAST_STATUS: _notmuch_status = 19;
/// ///
/// A zero value (NOTMUCH_STATUS_SUCCESS) indicates that the function /// A zero value (NOTMUCH_STATUS_SUCCESS) indicates that the function
/// completed without error. Any other value indicates an error. /// completed without error. Any other value indicates an error.
@ -192,9 +193,9 @@ pub type notmuch_database_create_verbose = unsafe extern "C" fn(
) -> notmuch_status_t; ) -> notmuch_status_t;
/// Open database for reading only. /// Open database for reading only.
pub const notmuch_database_mode_t_NOTMUCH_DATABASE_MODE_READ_ONLY: notmuch_database_mode_t = 0; pub const NOTMUCH_DATABASE_MODE_READ_ONLY: notmuch_database_mode_t = 0;
/// Open database for reading and writing. /// Open database for reading and writing.
pub const notmuch_database_mode_t_NOTMUCH_DATABASE_MODE_READ_WRITE: notmuch_database_mode_t = 1; pub const NOTMUCH_DATABASE_MODE_READ_WRITE: notmuch_database_mode_t = 1;
/// Database open mode for notmuch_database_open. /// Database open mode for notmuch_database_open.
pub type notmuch_database_mode_t = u32; pub type notmuch_database_mode_t = u32;
/// Open an existing notmuch database located at 'path'. /// Open an existing notmuch database located at 'path'.
@ -640,13 +641,13 @@ pub type notmuch_query_create = unsafe extern "C" fn(
) -> *mut notmuch_query_t; ) -> *mut notmuch_query_t;
/// Oldest first. /// Oldest first.
pub const notmuch_sort_t_NOTMUCH_SORT_OLDEST_FIRST: notmuch_sort_t = 0; pub const NOTMUCH_SORT_OLDEST_FIRST: notmuch_sort_t = 0;
/// Newest first. /// Newest first.
pub const notmuch_sort_t_NOTMUCH_SORT_NEWEST_FIRST: notmuch_sort_t = 1; pub const NOTMUCH_SORT_NEWEST_FIRST: notmuch_sort_t = 1;
/// Sort by message-id. /// Sort by message-id.
pub const notmuch_sort_t_NOTMUCH_SORT_MESSAGE_ID: notmuch_sort_t = 2; pub const NOTMUCH_SORT_MESSAGE_ID: notmuch_sort_t = 2;
/// Do not sort. /// Do not sort.
pub const notmuch_sort_t_NOTMUCH_SORT_UNSORTED: notmuch_sort_t = 3; pub const NOTMUCH_SORT_UNSORTED: notmuch_sort_t = 3;
/// Sort values for notmuch_query_set_sort. /// Sort values for notmuch_query_set_sort.
pub type notmuch_sort_t = u32; pub type notmuch_sort_t = u32;
/// Return the query_string of this query. See notmuch_query_create. /// Return the query_string of this query. See notmuch_query_create.
@ -657,9 +658,9 @@ pub type notmuch_query_get_query_string =
pub type notmuch_query_get_database = pub type notmuch_query_get_database =
unsafe extern "C" fn(query: *const notmuch_query_t) -> *mut notmuch_database_t; unsafe extern "C" fn(query: *const notmuch_query_t) -> *mut notmuch_database_t;
pub const notmuch_exclude_t_NOTMUCH_EXCLUDE_FLAG: notmuch_exclude_t = 0; pub const NOTMUCH_EXCLUDE_FLAG: notmuch_exclude_t = 0;
pub const notmuch_exclude_t_NOTMUCH_EXCLUDE_TRUE: notmuch_exclude_t = 1; pub const NOTMUCH_EXCLUDE_TRUE: notmuch_exclude_t = 1;
pub const notmuch_exclude_t_NOTMUCH_EXCLUDE_FALSE: notmuch_exclude_t = 2; pub const NOTMUCH_EXCLUDE_FALSE: notmuch_exclude_t = 2;
pub const notmuch_exclude_t_NOTMUCH_EXCLUDE_ALL: notmuch_exclude_t = 3; pub const notmuch_exclude_t_NOTMUCH_EXCLUDE_ALL: notmuch_exclude_t = 3;
/// Exclude values for notmuch_query_set_omit_excluded. The strange /// Exclude values for notmuch_query_set_omit_excluded. The strange
/// order is to maintain backward compatibility: the old FALSE/TRUE /// order is to maintain backward compatibility: the old FALSE/TRUE
@ -1260,9 +1261,9 @@ pub type notmuch_message_reindex = unsafe extern "C" fn(
indexopts: *mut notmuch_indexopts_t, indexopts: *mut notmuch_indexopts_t,
) -> notmuch_status_t; ) -> notmuch_status_t;
pub const _notmuch_message_flag_NOTMUCH_MESSAGE_FLAG_MATCH: _notmuch_message_flag = 0; pub const NOTMUCH_MESSAGE_FLAG_MATCH: _notmuch_message_flag = 0;
pub const _notmuch_message_flag_NOTMUCH_MESSAGE_FLAG_EXCLUDED: _notmuch_message_flag = 1; pub const NOTMUCH_MESSAGE_FLAG_EXCLUDED: _notmuch_message_flag = 1;
pub const _notmuch_message_flag_NOTMUCH_MESSAGE_FLAG_GHOST: _notmuch_message_flag = 2; pub const NOTMUCH_MESSAGE_FLAG_GHOST: _notmuch_message_flag = 2;
/// Message flags. /// Message flags.
pub type _notmuch_message_flag = u32; pub type _notmuch_message_flag = u32;
pub use self::_notmuch_message_flag as notmuch_message_flag_t; pub use self::_notmuch_message_flag as notmuch_message_flag_t;
@ -2029,10 +2030,10 @@ pub type notmuch_config_list_destroy =
pub type notmuch_database_get_default_indexopts = pub type notmuch_database_get_default_indexopts =
unsafe extern "C" fn(db: *mut notmuch_database_t) -> *mut notmuch_indexopts_t; unsafe extern "C" fn(db: *mut notmuch_database_t) -> *mut notmuch_indexopts_t;
pub const notmuch_decryption_policy_t_NOTMUCH_DECRYPT_FALSE: notmuch_decryption_policy_t = 0; pub const NOTMUCH_DECRYPT_FALSE: notmuch_decryption_policy_t = 0;
pub const notmuch_decryption_policy_t_NOTMUCH_DECRYPT_TRUE: notmuch_decryption_policy_t = 1; pub const NOTMUCH_DECRYPT_TRUE: notmuch_decryption_policy_t = 1;
pub const notmuch_decryption_policy_t_NOTMUCH_DECRYPT_AUTO: notmuch_decryption_policy_t = 2; pub const NOTMUCH_DECRYPT_AUTO: notmuch_decryption_policy_t = 2;
pub const notmuch_decryption_policy_t_NOTMUCH_DECRYPT_NOSTASH: notmuch_decryption_policy_t = 3; pub const NOTMUCH_DECRYPT_NOSTASH: notmuch_decryption_policy_t = 3;
/// Stating a policy about how to decrypt messages. /// Stating a policy about how to decrypt messages.
/// ///
/// See index.decrypt in notmuch-config(1) for more details. /// See index.decrypt in notmuch-config(1) for more details.

@ -24,13 +24,12 @@ use std::{cell::Cell, marker::PhantomData, ptr::NonNull};
use super::*; use super::*;
use crate::{ use crate::{
notmuch::ffi::{ notmuch::ffi::{
_notmuch_status_NOTMUCH_STATUS_READ_ONLY_DATABASE, notmuch_database_find_message, notmuch_message_add_tag, notmuch_message_destroy,
_notmuch_status_NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW, notmuch_database_find_message, notmuch_message_freeze, notmuch_message_get_date, notmuch_message_get_filename,
notmuch_message_add_tag, notmuch_message_destroy, notmuch_message_freeze, notmuch_message_get_header, notmuch_message_get_message_id, notmuch_message_get_replies,
notmuch_message_get_date, notmuch_message_get_filename, notmuch_message_get_header, notmuch_message_remove_tag, notmuch_message_tags_to_maildir_flags, notmuch_message_thaw,
notmuch_message_get_message_id, notmuch_message_get_replies, notmuch_message_remove_tag, notmuch_messages_get, notmuch_messages_move_to_next, notmuch_messages_valid,
notmuch_message_tags_to_maildir_flags, notmuch_message_thaw, notmuch_messages_get, NOTMUCH_STATUS_READ_ONLY_DATABASE, NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW,
notmuch_messages_move_to_next, notmuch_messages_valid,
}, },
thread::{ThreadHash, ThreadNode, ThreadNodeHash}, thread::{ThreadHash, ThreadNode, ThreadNodeHash},
}; };
@ -260,7 +259,8 @@ impl<'m> Message<'m> {
/// Quoted from `libnotmuch` C header: /// Quoted from `libnotmuch` C header:
/// ///
/// > The returned filename is an absolute filename, (the initial /// > The returned filename is an absolute filename, (the initial
/// > component will match `notmuch_database_get_path()`). /// > component will match
/// > [`notmuch_database_get_path`](crate::notmuch::ffi::notmuch_database_get_path)).
/// > /// >
/// > The returned string belongs to the message so should not be /// > The returned string belongs to the message so should not be
/// > modified or freed by the caller (nor should it be referenced after /// > modified or freed by the caller (nor should it be referenced after
@ -269,7 +269,9 @@ impl<'m> Message<'m> {
/// > Note: If this message corresponds to multiple files in the mail /// > Note: If this message corresponds to multiple files in the mail
/// > store, (that is, multiple files contain identical message IDs), /// > store, (that is, multiple files contain identical message IDs),
/// > this function will arbitrarily return a single one of those /// > this function will arbitrarily return a single one of those
/// > filenames. See `notmuch_message_get_filenames` for returning the /// > filenames. See
/// > [`notmuch_message_get_filenames`](crate::notmuch::ffi::notmuch_message_get_filenames)
/// > for returning the
/// > complete list of filenames. /// > complete list of filenames.
#[doc(alias = "notmuch_message_get_filename")] #[doc(alias = "notmuch_message_get_filename")]
pub fn get_filename(&self) -> &OsStr { pub fn get_filename(&self) -> &OsStr {
@ -284,9 +286,10 @@ impl<'m> Message<'m> {
/// Quoted from `libnotmuch` C header: /// Quoted from `libnotmuch` C header:
/// ///
/// > This means that changes to the message state, (via /// > This means that changes to the message state, (via
/// > notmuch_message_add_tag, notmuch_message_remove_tag, and /// > [`notmuch_message_add_tag`], [`notmuch_message_remove_tag`](, and
/// > notmuch_message_remove_all_tags), will not be committed to the /// > [`notmuch_message_remove_all_tags`](crate::notmuch::ffi::notmuch_message_remove_all_tags)), will not be committed to the
/// > database until the message is thawed with notmuch_message_thaw. /// > database until the message is thawed with
/// > [`notmuch_message_thaw`].
/// > /// >
/// > Multiple calls to freeze/thaw are valid and these calls will /// > Multiple calls to freeze/thaw are valid and these calls will
/// > "stack". That is there must be as many calls to thaw as to freeze /// > "stack". That is there must be as many calls to thaw as to freeze
@ -314,17 +317,17 @@ impl<'m> Message<'m> {
/// > Imagine the example above without freeze/thaw and the operation /// > Imagine the example above without freeze/thaw and the operation
/// > somehow getting interrupted. This could result in the message being /// > somehow getting interrupted. This could result in the message being
/// > left with no tags if the interruption happened after /// > left with no tags if the interruption happened after
/// > notmuch_message_remove_all_tags but before notmuch_message_add_tag. /// > [`notmuch_message_remove_all_tags`](crate::notmuch::ffi::notmuch_message_remove_all_tags) but before [`notmuch_message_add_tag`].
/// > /// >
/// > Return value: /// > Return value:
/// > /// >
/// > - `NOTMUCH_STATUS_SUCCESS`: Message successfully frozen. /// > - [`NOTMUCH_STATUS_SUCCESS`](crate::notmuch::ffi::NOTMUCH_STATUS_SUCCESS): Message successfully frozen.
/// > - `NOTMUCH_STATUS_READ_ONLY_DATABASE`: Database was opened in /// > - [`NOTMUCH_STATUS_READ_ONLY_DATABASE`]: Database was opened in
/// > read-only /// > read-only
/// > mode so message cannot be modified. /// > mode so message cannot be modified.
#[doc(alias = "notmuch_message_freeze")] #[doc(alias = "notmuch_message_freeze")]
pub fn freeze(&self) { pub fn freeze(&self) {
if _notmuch_status_NOTMUCH_STATUS_READ_ONLY_DATABASE if NOTMUCH_STATUS_READ_ONLY_DATABASE
== unsafe { call!(self.lib, notmuch_message_freeze)(self.message.as_ptr()) } == unsafe { call!(self.lib, notmuch_message_freeze)(self.message.as_ptr()) }
{ {
return; return;
@ -347,19 +350,23 @@ impl<'m> Message<'m> {
/// > /// >
/// > Return value: /// > Return value:
/// > /// >
/// > - `NOTMUCH_STATUS_SUCCESS`: Message successfully thawed, (or at least /// > - [`NOTMUCH_STATUS_SUCCESS`](crate::notmuch::ffi::NOTMUCH_STATUS_SUCCESS): Message successfully thawed, (or at
/// > least
/// > its frozen count has successfully been reduced by 1). /// > its frozen count has successfully been reduced by 1).
/// > - `NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW`: An attempt was made to thaw /// > - [`NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW`]: An attempt was made to
/// > thaw
/// > an unfrozen message. That is, there have been an unbalanced /// > an unfrozen message. That is, there have been an unbalanced
/// > number of calls to `notmuch_message_freeze` and /// > number of calls to
/// > `notmuch_message_thaw`. /// > [`notmuch_message_freeze`]
/// > and
/// > [`notmuch_message_thaw`].
#[doc(alias = "notmuch_message_thaw")] #[doc(alias = "notmuch_message_thaw")]
pub fn thaw(&self) { pub fn thaw(&self) {
if self.freezes.get() == 0 { if self.freezes.get() == 0 {
return; return;
} }
if _notmuch_status_NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW if NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW
== unsafe { call!(self.lib, notmuch_message_thaw)(self.message.as_ptr()) } == unsafe { call!(self.lib, notmuch_message_thaw)(self.message.as_ptr()) }
{ {
return; return;

@ -59,7 +59,7 @@ macro_rules! call {
macro_rules! try_call { macro_rules! try_call {
($lib:expr, $call:expr) => {{ ($lib:expr, $call:expr) => {{
let status = $call; let status = $call;
if status == $crate::notmuch::ffi::_notmuch_status_NOTMUCH_STATUS_SUCCESS { if status == $crate::notmuch::ffi::NOTMUCH_STATUS_SUCCESS {
Ok(()) Ok(())
} else { } else {
let c_str = call!($lib, notmuch_status_to_string)(status); let c_str = call!($lib, notmuch_status_to_string)(status);
@ -505,9 +505,9 @@ impl NotmuchDb {
call!(lib, notmuch_database_open)( call!(lib, notmuch_database_open)(
path_ptr, path_ptr,
if write { if write {
ffi::notmuch_database_mode_t_NOTMUCH_DATABASE_MODE_READ_WRITE ffi::NOTMUCH_DATABASE_MODE_READ_WRITE
} else { } else {
ffi::notmuch_database_mode_t_NOTMUCH_DATABASE_MODE_READ_ONLY ffi::NOTMUCH_DATABASE_MODE_READ_ONLY
}, },
std::ptr::addr_of_mut!(database), std::ptr::addr_of_mut!(database),
) )

@ -110,11 +110,12 @@ impl Drop for Thread<'_> {
/// Quoting the docs: /// Quoting the docs:
/// ///
/// > Note that there's no explicit destructor needed for the /// > Note that there's no explicit destructor needed for the
/// > notmuch_threads_t object. (For consistency, we do provide a /// > [`notmuch_threads_t`] object. (For consistency, we do provide a
/// > notmuch_threads_destroy function, but there's no good reason /// > [`notmuch_threads_destroy`][crate::notmuch::ffi::notmuch_threads_destroy]
/// > function, but there's no good reason
/// > to call it if the query is about to be destroyed). /// > to call it if the query is about to be destroyed).
/// ///
/// So there's no need to implement Drop for this type. /// So there's no need to implement [`Drop`] for this type.
pub struct ThreadsIterator<'query> { pub struct ThreadsIterator<'query> {
pub lib: Arc<NotmuchLibrary>, pub lib: Arc<NotmuchLibrary>,
pub inner: Option<NonNull<notmuch_threads_t>>, pub inner: Option<NonNull<notmuch_threads_t>>,

@ -101,7 +101,7 @@ macro_rules! get_class {
}}; }};
} }
/// Side effects: Updates $graph_iter and potentially $idx and $grapheme /// Side effects: Updates `$graph_iter` and potentially `$idx` and `$grapheme`
macro_rules! next_grapheme_class { macro_rules! next_grapheme_class {
($graph_iter:ident, $grapheme:ident) => ({ ($graph_iter:ident, $grapheme:ident) => ({
if let Some((_, g)) = $graph_iter.next() { if let Some((_, g)) = $graph_iter.next() {

@ -815,7 +815,7 @@ impl Threads {
} }
} }
/// Update show_subject details of ThreadNode /// Update `show_subject` details of [`ThreadNode`].
pub fn update_show_subject( pub fn update_show_subject(
&mut self, &mut self,
id: ThreadNodeHash, id: ThreadNodeHash,

@ -497,7 +497,7 @@ fn decode_utf8_lossy(input: Cow<'_, [u8]>) -> Cow<'_, str> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
/// https://url.spec.whatwg.org/#fragment-percent-encode-set /// <https://url.spec.whatwg.org/#fragment-percent-encode-set>
const FRAGMENT: &AsciiSet = &NON_ALPHANUMERIC const FRAGMENT: &AsciiSet = &NON_ALPHANUMERIC
.add(b' ') .add(b' ')
.add(b'"') .add(b'"')

@ -23,12 +23,10 @@
//! `xdg-utils`. //! `xdg-utils`.
//! //!
//! # What is implemented? //! # What is implemented?
//! * Function <a class="fn" href="fn.query_default_app.html" //! * Function [`query_default_app`] performs like the `xdg-utils` function
//! title="xdg_utils::query_default_app fn">query_default_app</a> performs //! `binary_to_desktop_file`.
//! like the xdg-utils function `binary_to_desktop_file` //! * Function [`query_mime_info`] launches the `mimetype` or else the `file`
//! * Function <a class="fn" href="fn.query_mime_info.html" //! command.
//! title="xdg_utils::query_mime_info fn">query_mime_info</a> launches the
//! `mimetype` or else the `file` command.
//! //!
//! Some of the utils may be implemented by combining these functions with other //! Some of the utils may be implemented by combining these functions with other
//! functions in the Rust standard library. //! functions in the Rust standard library.

Loading…
Cancel
Save