rustdoc: add unstable features rustdoc-scrape-examples and rustdoc-map

axum-login-upgrade
Manos Pitsidianakis 2023-06-18 12:43:23 +03:00
parent 8e8bf19f67
commit 8d7c567d5e
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
9 changed files with 68 additions and 52 deletions

2
.cargo/config 100644
View File

@ -0,0 +1,2 @@
[doc.extern-map.registries]
crates-io = "https://docs.rs/"

View File

@ -30,7 +30,7 @@ jobs:
override: true
- name: Make rustdocs
run: |
make rustdoc
make rustdoc-nightly || make rustdoc
rm -rf docs
ls -R
mv target/doc docs

View File

@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"archive-http",
"cli",

View File

@ -36,3 +36,11 @@ rustdoc:
.PHONY: rustdoc-open
rustdoc-open:
@RUSTDOCFLAGS="--html-before-content ./.github/doc_extra.html" $(CARGOBIN) doc --workspace --all-features --no-deps --document-private-items --open
.PHONY: rustdoc-nightly
rustdoc-nightly:
@RUSTDOCFLAGS="--html-before-content ./.github/doc_extra.html" $(CARGOBIN) +nightly doc -Zrustdoc-map -Z rustdoc-scrape-examples --workspace --all-features --no-deps --document-private-items
.PHONY: rustdoc-nightly-open
rustdoc-nightly-open:
@RUSTDOCFLAGS="--html-before-content ./.github/doc_extra.html" $(CARGOBIN) +nightly doc -Zrustdoc-map -Z rustdoc-scrape-examples --workspace --all-features --no-deps --document-private-items --open

View File

@ -14,10 +14,11 @@ default-run = "mpot"
[[bin]]
name = "mpot"
path = "src/main.rs"
doc-scrape-examples = true
[dependencies]
base64 = { version = "0.21" }
clap = { version = "^4.2", default-features = false, features = ["derive", "cargo", "unicode", "help", "usage", "error-context", "suggestions"] }
clap = { version = "^4.2", default-features = false, features = ["std", "derive", "cargo", "unicode", "help", "usage", "error-context", "suggestions"] }
log = "0.4"
mailpot = { version = "^0.1", path = "../core" }
serde = { version = "^1", features = ["derive", ] }
@ -32,7 +33,7 @@ predicates = "3"
tempfile = "3.3"
[build-dependencies]
clap = { version = "^4.2", default-features = false, features = ["derive", "cargo", "unicode", "wrap_help", "help", "usage", "error-context", "suggestions"] }
clap = { version = "^4.2", default-features = false, features = ["std", "derive", "cargo", "unicode", "wrap_help", "help", "usage", "error-context", "suggestions"] }
clap_mangen = "0.2.10"
mailpot = { version = "^0.1", path = "../core" }
stderrlog = "^0.5"

View File

@ -10,6 +10,9 @@ repository = "https://github.com/meli/mailpot"
keywords = ["mail", "mailing-lists"]
categories = ["email"]
[lib]
doc-scrape-examples = true
[dependencies]
anyhow = "1.0.58"
chrono = { version = "^0.4", features = ["serde", ] }

View File

@ -19,7 +19,7 @@
//! Named templates, for generated e-mail like confirmations, alerts etc.
//!
//! Template database model: [`Template`].
//! Template database model: [`Template`](crate::Template).
use std::collections::HashMap;

View File

@ -61,10 +61,12 @@ mod post_policy {
/// Remove an existing list policy.
///
/// # Examples
///
/// ```
/// # use mailpot::{models::*, Configuration, Connection, SendMail};
/// # use tempfile::TempDir;
///
/// #
/// # let tmp_dir = TempDir::new().unwrap();
/// # let db_path = tmp_dir.path().join("mpot.db");
/// # let config = Configuration {
@ -73,7 +75,7 @@ mod post_policy {
/// # data_path: tmp_dir.path().to_path_buf(),
/// # administrators: vec![],
/// # };
///
/// #
/// # fn do_test(config: Configuration) {
/// let db = Connection::open_or_create_db(config).unwrap().trusted();
/// # assert!(db.list_post_policy(1).unwrap().is_none());
@ -107,6 +109,26 @@ mod post_policy {
/// # }
/// # do_test(config);
/// ```
///
/// ```should_panic
/// # use mailpot::{models::*, Configuration, Connection, SendMail};
/// # use tempfile::TempDir;
/// #
/// # let tmp_dir = TempDir::new().unwrap();
/// # let db_path = tmp_dir.path().join("mpot.db");
/// # let config = Configuration {
/// # send_mail: SendMail::ShellCommand("/usr/bin/false".to_string()),
/// # db_path: db_path.clone(),
/// # data_path: tmp_dir.path().to_path_buf(),
/// # administrators: vec![],
/// # };
/// #
/// # fn do_test(config: Configuration) {
/// let db = Connection::open_or_create_db(config).unwrap().trusted();
/// db.remove_list_post_policy(1, 1).unwrap();
/// # }
/// # do_test(config);
/// ```
pub fn remove_list_post_policy(&self, list_pk: i64, policy_pk: i64) -> Result<()> {
let mut stmt = self
.connection
@ -124,28 +146,6 @@ mod post_policy {
Ok(())
}
/// ```should_panic
/// # use mailpot::{models::*, Configuration, Connection, SendMail};
/// # use tempfile::TempDir;
///
/// # let tmp_dir = TempDir::new().unwrap();
/// # let db_path = tmp_dir.path().join("mpot.db");
/// # let config = Configuration {
/// # send_mail: SendMail::ShellCommand("/usr/bin/false".to_string()),
/// # db_path: db_path.clone(),
/// # data_path: tmp_dir.path().to_path_buf(),
/// # administrators: vec![],
/// # };
///
/// # fn do_test(config: Configuration) {
/// let db = Connection::open_or_create_db(config).unwrap().trusted();
/// db.remove_list_post_policy(1, 1).unwrap();
/// # }
/// # do_test(config);
/// ```
#[cfg(doc)]
pub fn remove_list_post_policy_panic() {}
/// Set the unique post policy for a list.
pub fn set_list_post_policy(&self, policy: PostPolicy) -> Result<DbVal<PostPolicy>> {
if !(policy.announce_only
@ -257,10 +257,12 @@ mod subscription_policy {
/// Remove an existing subscription policy.
///
/// # Examples
///
/// ```
/// # use mailpot::{models::*, Configuration, Connection, SendMail};
/// # use tempfile::TempDir;
///
/// #
/// # let tmp_dir = TempDir::new().unwrap();
/// # let db_path = tmp_dir.path().join("mpot.db");
/// # let config = Configuration {
@ -269,7 +271,7 @@ mod subscription_policy {
/// # data_path: tmp_dir.path().to_path_buf(),
/// # administrators: vec![],
/// # };
///
/// #
/// # fn do_test(config: Configuration) {
/// let db = Connection::open_or_create_db(config).unwrap().trusted();
/// let list = db
@ -302,6 +304,26 @@ mod subscription_policy {
/// # }
/// # do_test(config);
/// ```
///
/// ```should_panic
/// # use mailpot::{models::*, Configuration, Connection, SendMail};
/// # use tempfile::TempDir;
/// #
/// # let tmp_dir = TempDir::new().unwrap();
/// # let db_path = tmp_dir.path().join("mpot.db");
/// # let config = Configuration {
/// # send_mail: SendMail::ShellCommand("/usr/bin/false".to_string()),
/// # db_path: db_path.clone(),
/// # data_path: tmp_dir.path().to_path_buf(),
/// # administrators: vec![],
/// # };
/// #
/// # fn do_test(config: Configuration) {
/// let db = Connection::open_or_create_db(config).unwrap().trusted();
/// db.remove_list_post_policy(1, 1).unwrap();
/// # }
/// # do_test(config);
/// ```
pub fn remove_list_subscription_policy(&self, list_pk: i64, policy_pk: i64) -> Result<()> {
let mut stmt = self.connection.prepare(
"DELETE FROM subscription_policy WHERE pk = ? AND list = ? RETURNING *;",
@ -319,28 +341,6 @@ mod subscription_policy {
Ok(())
}
/// ```should_panic
/// # use mailpot::{models::*, Configuration, Connection, SendMail};
/// # use tempfile::TempDir;
///
/// # let tmp_dir = TempDir::new().unwrap();
/// # let db_path = tmp_dir.path().join("mpot.db");
/// # let config = Configuration {
/// # send_mail: SendMail::ShellCommand("/usr/bin/false".to_string()),
/// # db_path: db_path.clone(),
/// # data_path: tmp_dir.path().to_path_buf(),
/// # administrators: vec![],
/// # };
///
/// # fn do_test(config: Configuration) {
/// let db = Connection::open_or_create_db(config).unwrap().trusted();
/// db.remove_list_post_policy(1, 1).unwrap();
/// # }
/// # do_test(config);
/// ```
#[cfg(doc)]
pub fn remove_list_subscription_policy_panic() {}
/// Set the unique post policy for a list.
pub fn set_list_subscription_policy(
&self,

View File

@ -13,6 +13,7 @@ categories = ["email"]
[[bin]]
name = "mpot-web"
path = "src/main.rs"
doc-scrape-examples = true
[dependencies]
axum = { version = "^0.6" }