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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#![no_std]
#![allow(dead_code)]
#[macro_use]
extern crate derive_more;
#[derive(
AddAssign,
MulAssign,
Add,
Mul,
Not,
Index,
Display,
FromStr,
Into,
From,
IndexMut,
Sum,
Deref,
DerefMut,
Constructor
)]
#[into(owned, ref, ref_mut)]
struct MyInts(u64);
#[derive(Deref, DerefMut)]
#[deref(forward)]
#[deref_mut(forward)]
struct MyBoxedInt<'a>(&'a mut u64);
#[derive(
From,
FromStr,
Display,
Index,
Not,
Add,
Mul,
Sum,
IndexMut,
AddAssign,
Deref,
DerefMut,
IntoIterator,
Constructor
)]
#[deref(forward)]
#[deref_mut(forward)]
#[into_iterator(owned, ref, ref_mut)]
struct Wrapped<T: Clone>(T);
#[derive(Deref, DerefMut)]
struct Wrapped2<T: Clone>(T);
#[derive(From, Not, Add, Mul, AddAssign, Constructor, Sum)]
struct WrappedDouble<T: Clone, U: Clone>(T, U);
#[derive(Add, Not, TryInto)]
#[try_into(owned, ref, ref_mut)]
enum MixedInts {
SmallInt(i32),
BigInt(i64),
TwoSmallInts(i32, i32),
NamedSmallInts { x: i32, y: i32 },
UnsignedOne(u32),
UnsignedTwo(u32),
}
#[derive(Not, Add)]
enum EnumWithUnit {
SmallInt(i32),
Unit,
}
|