Debian Codegraph @

third_party/rust/derive_more/tests/no_std.rs

raw
1 #![no_std]
2 #![allow(dead_code)]
3
4 use derive_more::{
5 Add, AddAssign, Constructor, Deref, DerefMut, Display, From, FromStr, Index,
6 IndexMut, Into, IntoIterator, Mul, MulAssign, Not, Sum, TryInto,
7 };
8
9 #[derive(
10 AddAssign,
11 MulAssign,
12 Add,
13 Mul,
14 Not,
15 Index,
16 Display,
17 FromStr,
18 Into,
19 From,
20 IndexMut,
21 Sum,
22 Deref,
23 DerefMut,
24 Constructor
25 )]
26 #[into(owned, ref, ref_mut)]
27 struct MyInts(u64);
28
29 #[derive(Deref, DerefMut)]
30 #[deref(forward)]
31 #[deref_mut(forward)]
32 struct MyBoxedInt<'a>(&'a mut u64);
33
34 #[derive(
35 From,
36 FromStr,
37 Display,
38 Index,
39 Not,
40 Add,
41 Mul,
42 Sum,
43 IndexMut,
44 AddAssign,
45 Deref,
46 DerefMut,
47 IntoIterator,
48 Constructor
49 )]
50 #[deref(forward)]
51 #[deref_mut(forward)]
52 #[into_iterator(owned, ref, ref_mut)]
53 struct Wrapped<T: Clone>(T);
54
55 #[derive(Deref, DerefMut)]
56 struct Wrapped2<T: Clone>(T);
57
58 #[derive(From, Not, Add, Mul, AddAssign, Constructor, Sum)]
59 struct WrappedDouble<T: Clone, U: Clone>(T, U);
60
61 #[derive(Add, Not, TryInto)]
62 #[try_into(owned, ref, ref_mut)]
63 enum MixedInts {
64 SmallInt(i32),
65 BigInt(i64),
66 TwoSmallInts(i32, i32),
67 NamedSmallInts { x: i32, y: i32 },
68 UnsignedOne(u32),
69 UnsignedTwo(u32),
70 }
71
72 #[derive(Not, Add)]
73 enum EnumWithUnit {
74 SmallInt(i32),
75 Unit,
76 }