1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Macros used for generating documentation
/// A macro for generating the doc-comments for mutable versions of various
/// image processing functions. It takes the name of then non-mut function as an
/// argument as a string literal.
///
/// It uses concat! to generate doc-links to the provided original function name
/// in string literal form.
macro_rules! generate_mut_doc_comment {
($name:literal) => {
concat!(
"An in-place version of [`",
$name,
"()`].\n\nThis function does the same operation as [`",
$name,
"()`] but on the `&mut image`\npassed rather than cloning an `&image`. This is faster but you lose the\noriginal image."
)
};
}
/// A macro for generating the doc-comments for parallel versions of various
/// image processing functions. It takes the name of the non-parallel function as an
/// argument as a string literal.
///
/// It uses concat! to generate doc-links to the provided original function name
/// in string literal form.
macro_rules! generate_parallel_doc_comment {
($name:literal) => {
concat!(
"An parallel version of [`",
$name,
"()`].\n\nThis function does the same operation as [`",
$name,
"()`] but using multi-threading via [`rayon`](https://docs.rs/rayon) iterators.\nRead the top-level crate documentation on parallelism for some of the tradeoffs involved with multi-threaded vs single-threaded image processing functions."
)
};
}