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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use TokenStream;
pub
pub
pub
pub
/// The main attribute macro to annotate functions, structs, etc. with versioning information.
/// It is able to record multiple version entries, each separated by a semicolon.
/// Where if the last version is marked as deprecated, it will generate a #[deprecated] attribute to warn users.
///
/// # Example
///
/// The minimal example (Which will warn user):
///
/// ```ignore
/// #[ver(deprecated, since = "0.1.0")]
/// pub fn minimal_example() {
/// println!("This is a minimal example");
/// }
/// ```
///
/// The full example with multiple versions:
///
/// (This will not warn user as the latest version is not deprecated. Documentation will be generated for all versions as a log. Only the latest version is shown as highlighted.)
///
/// ```ignore
/// #[ver(
/// update, since = "1.2.0", note = "Added new parameter", date = "2024-03-01", author = "Akari";
/// stable, since = "1.1.0", note = "First stable release", date = "2024-02-01", author = "Akari";
/// unstable, since = "0.1.0", note = "Initial implementation", date = "2024-01-01", author = "Akari"
/// )]
/// pub fn full_example(value: i32, new_param: bool) {
/// println!("Value: {}, New Param: {}", value, new_param);
/// }
/// ```