bump_scope/
doc.rs

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
macro_rules! use_mut_instead {
    ($what:ident) => {
        concat!(
            "\n\n",
            "If you have a `&mut self` you can use [`",
            stringify!($what),
            "`](Self::",
            stringify!($what),
            ") instead for better performance.",
        )
    };
}

pub(crate) use use_mut_instead;

macro_rules! mut_alloc_function {
    ($compared_to:ident, $the_what:literal) => {
        concat!(
            "\n\n",
            "This function is designed as a performance improvement over [`",
            stringify!($compared_to),
            "`](Self::",
            stringify!($compared_to),
            "). By taking `self` as `&mut`, it can use the entire remaining chunk space ",
            "as the capacity for its ",
            $the_what,
            ". As a result, the ",
            $the_what,
            " rarely needs to grow.",
        )
    };
}

pub(crate) use mut_alloc_function;