Add more documentation comments

This commit is contained in:
link2xt
2023-02-23 12:55:43 +00:00
parent ee81d61988
commit ade3d0d4eb
7 changed files with 23 additions and 0 deletions

View File

@@ -476,10 +476,13 @@ impl Config {
struct AccountConfig { struct AccountConfig {
/// Unique id. /// Unique id.
pub id: u32, pub id: u32,
/// Root directory for all data for this account. /// Root directory for all data for this account.
/// ///
/// The path is relative to the account manager directory. /// The path is relative to the account manager directory.
pub dir: std::path::PathBuf, pub dir: std::path::PathBuf,
/// Universally unique account identifier.
pub uuid: Uuid, pub uuid: Uuid,
} }

View File

@@ -1881,7 +1881,10 @@ pub(crate) async fn update_special_chat_names(context: &Context) -> Result<()> {
/// [`Deref`]: std::ops::Deref /// [`Deref`]: std::ops::Deref
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct ChatIdBlocked { pub(crate) struct ChatIdBlocked {
/// Chat ID.
pub id: ChatId, pub id: ChatId,
/// Whether the chat is blocked, unblocked or a contact request.
pub blocked: Blocked, pub blocked: Blocked,
} }

View File

@@ -646,10 +646,14 @@ async fn try_smtp_one_param(
} }
} }
/// Failure to connect and login with email client configuration.
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
#[error("Trying {config}…\nError: {msg}")] #[error("Trying {config}…\nError: {msg}")]
pub struct ConfigurationError { pub struct ConfigurationError {
/// Tried configuration description.
config: String, config: String,
/// Error message.
msg: String, msg: String,
} }

View File

@@ -116,6 +116,8 @@ impl async_imap::Authenticator for OAuth2 {
#[derive(Debug, Display, PartialEq, Eq, Clone, Copy)] #[derive(Debug, Display, PartialEq, Eq, Clone, Copy)]
pub enum FolderMeaning { pub enum FolderMeaning {
Unknown, Unknown,
/// Spam folder.
Spam, Spam,
Inbox, Inbox,
Mvbox, Mvbox,
@@ -149,8 +151,11 @@ impl FolderMeaning {
#[derive(Debug)] #[derive(Debug)]
struct ImapConfig { struct ImapConfig {
/// Email address.
pub addr: String, pub addr: String,
pub lp: ServerLoginParam, pub lp: ServerLoginParam,
/// SOCKS 5 configuration.
pub socks5_config: Option<Socks5Config>, pub socks5_config: Option<Socks5Config>,
pub strict_tls: bool, pub strict_tls: bool,
} }

View File

@@ -1,3 +1,5 @@
//! # IMAP folder selection module.
use anyhow::Context as _; use anyhow::Context as _;
use super::session::Session as ImapSession; use super::session::Session as ImapSession;

View File

@@ -473,11 +473,15 @@ fn decode_webrtc_instance(_context: &Context, qr: &str) -> Result<Qr> {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct CreateAccountSuccessResponse { struct CreateAccountSuccessResponse {
/// Email address.
email: String, email: String,
/// Password.
password: String, password: String,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct CreateAccountErrorResponse { struct CreateAccountErrorResponse {
/// Reason for the failure to create account returned by the server.
reason: String, reason: String,
} }

View File

@@ -592,6 +592,8 @@ pub(crate) fn improve_single_line_input(input: &str) -> String {
} }
pub(crate) trait IsNoneOrEmpty<T> { pub(crate) trait IsNoneOrEmpty<T> {
/// Returns true if an Option does not contain a string
/// or contains an empty string.
fn is_none_or_empty(&self) -> bool; fn is_none_or_empty(&self) -> bool;
} }
impl<T> IsNoneOrEmpty<T> for Option<T> impl<T> IsNoneOrEmpty<T> for Option<T>