-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathbasic.rs
More file actions
43 lines (39 loc) · 1.03 KB
/
basic.rs
File metadata and controls
43 lines (39 loc) · 1.03 KB
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
use stackable_versioned::versioned;
// To expand the generated code (for debugging and testing), it is recommended
// to first change directory via `cd crates/stackable-versioned` and to then
// run `cargo expand --test basic --all-features`.
#[allow(dead_code)]
#[versioned(
version(name = "v1alpha1"),
version(name = "v1beta1"),
version(name = "v1"),
version(name = "v2"),
version(name = "v3")
)]
struct Foo {
/// My docs
#[versioned(
added(since = "v1alpha1"),
renamed(since = "v1beta1", from = "jjj"),
deprecated(since = "v2", note = "not empty")
)]
deprecated_bar: usize,
baz: bool,
}
#[test]
fn basic() {
let _ = v1alpha1::Foo { jjj: 0, baz: false };
let _ = v1beta1::Foo { bar: 0, baz: false };
let _ = v1::Foo { bar: 0, baz: false };
#[allow(deprecated)]
let _ = v2::Foo {
deprecated_bar: 0,
baz: false,
};
// The latest version (v3)
#[allow(deprecated)]
let _ = Foo {
deprecated_bar: 0,
baz: false,
};
}