Debian Codegraph @

third_party/rust/derive_more/tests/constructor.rs

raw
1 #![cfg_attr(not(feature = "std"), no_std)]
2 #![allow(dead_code)]
3
4 use derive_more::Constructor;
5
6 #[derive(Constructor)]
7 struct EmptyTuple();
8
9 const EMPTY_TUPLE: EmptyTuple = EmptyTuple::new();
10
11 #[derive(Constructor)]
12 struct EmptyStruct {}
13
14 const EMPTY_STRUCT: EmptyStruct = EmptyStruct::new();
15
16 #[derive(Constructor)]
17 struct EmptyUnit;
18
19 const EMPTY_UNIT: EmptyUnit = EmptyUnit::new();
20
21 #[derive(Constructor)]
22 struct MyInts(i32, i32);
23
24 const MY_INTS: MyInts = MyInts::new(1, 2);
25
26 #[derive(Constructor)]
27 struct Point2D {
28 x: i32,
29 y: i32,
30 }
31
32 const POINT_2D: Point2D = Point2D::new(-4, 7);