@@ -49,10 +49,6 @@ macro_rules! getsockopt_impl {
49
49
50
50
// Helper to generate the sockopt accessors
51
51
macro_rules! sockopt_impl {
52
- ( GetOnly , $name: ident, $level: path, $flag: path, $ty: ty) => {
53
- sockopt_impl!( GetOnly , $name, $level, $flag, $ty, GetStruct <$ty>) ;
54
- } ;
55
-
56
52
( GetOnly , $name: ident, $level: path, $flag: path, bool ) => {
57
53
sockopt_impl!( GetOnly , $name, $level, $flag, bool , GetBool ) ;
58
54
} ;
@@ -65,17 +61,6 @@ macro_rules! sockopt_impl {
65
61
sockopt_impl!( GetOnly , $name, $level, $flag, usize , GetUsize ) ;
66
62
} ;
67
63
68
- ( GetOnly , $name: ident, $level: path, $flag: path, $ty: ty, $getter: ty) => {
69
- #[ derive( Copy , Clone , Debug ) ]
70
- pub struct $name;
71
-
72
- getsockopt_impl!( $name, $level, $flag, $ty, $getter) ;
73
- } ;
74
-
75
- ( SetOnly , $name: ident, $level: path, $flag: path, $ty: ty) => {
76
- sockopt_impl!( SetOnly , $name, $level, $flag, $ty, SetStruct <$ty>) ;
77
- } ;
78
-
79
64
( SetOnly , $name: ident, $level: path, $flag: path, bool ) => {
80
65
sockopt_impl!( SetOnly , $name, $level, $flag, bool , SetBool ) ;
81
66
} ;
@@ -88,31 +73,50 @@ macro_rules! sockopt_impl {
88
73
sockopt_impl!( SetOnly , $name, $level, $flag, usize , SetUsize ) ;
89
74
} ;
90
75
91
- ( SetOnly , $name: ident, $level: path, $flag: path, $ty : ty , $setter : ty ) => {
92
- # [ derive ( Copy , Clone , Debug ) ]
93
- pub struct $name ;
76
+ ( Both , $name: ident, $level: path, $flag: path, bool ) => {
77
+ sockopt_impl! ( Both , $name , $level , $flag , bool , GetBool , SetBool ) ;
78
+ } ;
94
79
95
- setsockopt_impl!( $name, $level, $flag, $ty, $setter) ;
80
+ ( Both , $name: ident, $level: path, $flag: path, u8 ) => {
81
+ sockopt_impl!( Both , $name, $level, $flag, u8 , GetU8 , SetU8 ) ;
96
82
} ;
97
83
98
- ( Both , $name: ident, $level: path, $flag: path, $ty: ty, $getter: ty, $setter: ty) => {
84
+ ( Both , $name: ident, $level: path, $flag: path, usize ) => {
85
+ sockopt_impl!( Both , $name, $level, $flag, usize , GetUsize , SetUsize ) ;
86
+ } ;
87
+
88
+ /*
89
+ * Matchers with generic getter types must be placed at the end, so
90
+ * they'll only match _after_ specialized matchers fail
91
+ */
92
+ ( GetOnly , $name: ident, $level: path, $flag: path, $ty: ty) => {
93
+ sockopt_impl!( GetOnly , $name, $level, $flag, $ty, GetStruct <$ty>) ;
94
+ } ;
95
+
96
+ ( GetOnly , $name: ident, $level: path, $flag: path, $ty: ty, $getter: ty) => {
99
97
#[ derive( Copy , Clone , Debug ) ]
100
98
pub struct $name;
101
99
102
- setsockopt_impl!( $name, $level, $flag, $ty, $setter) ;
103
100
getsockopt_impl!( $name, $level, $flag, $ty, $getter) ;
104
101
} ;
105
102
106
- ( Both , $name: ident, $level: path, $flag: path, bool ) => {
107
- sockopt_impl!( Both , $name, $level, $flag, bool , GetBool , SetBool ) ;
103
+ ( SetOnly , $name: ident, $level: path, $flag: path, $ty : ty ) => {
104
+ sockopt_impl!( SetOnly , $name, $level, $flag, $ty , SetStruct <$ty> ) ;
108
105
} ;
109
106
110
- ( Both , $name: ident, $level: path, $flag: path, u8 ) => {
111
- sockopt_impl!( Both , $name, $level, $flag, u8 , GetU8 , SetU8 ) ;
107
+ ( SetOnly , $name: ident, $level: path, $flag: path, $ty: ty, $setter: ty) => {
108
+ #[ derive( Copy , Clone , Debug ) ]
109
+ pub struct $name;
110
+
111
+ setsockopt_impl!( $name, $level, $flag, $ty, $setter) ;
112
112
} ;
113
113
114
- ( Both , $name: ident, $level: path, $flag: path, usize ) => {
115
- sockopt_impl!( Both , $name, $level, $flag, usize , GetUsize , SetUsize ) ;
114
+ ( Both , $name: ident, $level: path, $flag: path, $ty: ty, $getter: ty, $setter: ty) => {
115
+ #[ derive( Copy , Clone , Debug ) ]
116
+ pub struct $name;
117
+
118
+ setsockopt_impl!( $name, $level, $flag, $ty, $setter) ;
119
+ getsockopt_impl!( $name, $level, $flag, $ty, $getter) ;
116
120
} ;
117
121
118
122
( Both , $name: ident, $level: path, $flag: path, $ty: ty) => {
0 commit comments