@@ -100,37 +100,37 @@ impl PortReadWrite for u32 {}
100
100
101
101
/// A read only I/O port.
102
102
#[ derive( Debug , Clone , PartialEq , Eq ) ]
103
- pub struct PortReadOnly < T : PortRead > {
103
+ pub struct PortReadOnly < T > {
104
104
port : u16 ,
105
105
phantom : PhantomData < T > ,
106
106
}
107
107
108
108
/// A write only I/O port.
109
109
#[ derive( Debug , Clone , PartialEq , Eq ) ]
110
- pub struct PortWriteOnly < T : PortWrite > {
110
+ pub struct PortWriteOnly < T > {
111
111
port : u16 ,
112
112
phantom : PhantomData < T > ,
113
113
}
114
114
115
115
/// An I/O port.
116
116
#[ derive( Debug , Clone , PartialEq , Eq ) ]
117
- pub struct Port < T : PortReadWrite > {
117
+ pub struct Port < T > {
118
118
port : u16 ,
119
119
phantom : PhantomData < T > ,
120
120
}
121
121
122
- impl < T : PortRead > PortReadOnly < T > {
123
- const_fn ! {
124
- /// Creates a read only I/O port with the given port number.
125
- #[ inline]
126
- pub fn new( port: u16 ) -> PortReadOnly <T > {
127
- PortReadOnly {
128
- port,
129
- phantom: PhantomData ,
130
- }
122
+ impl < T > PortReadOnly < T > {
123
+ /// Creates a read only I/O port with the given port number.
124
+ #[ inline]
125
+ pub const fn new ( port : u16 ) -> PortReadOnly < T > {
126
+ PortReadOnly {
127
+ port,
128
+ phantom : PhantomData ,
131
129
}
132
130
}
131
+ }
133
132
133
+ impl < T : PortRead > PortReadOnly < T > {
134
134
/// Reads from the port.
135
135
///
136
136
/// ## Safety
@@ -143,18 +143,18 @@ impl<T: PortRead> PortReadOnly<T> {
143
143
}
144
144
}
145
145
146
- impl < T : PortWrite > PortWriteOnly < T > {
147
- const_fn ! {
148
- /// Creates a write only I/O port with the given port number.
149
- #[ inline]
150
- pub fn new( port: u16 ) -> PortWriteOnly <T > {
151
- PortWriteOnly {
152
- port,
153
- phantom: PhantomData ,
154
- }
146
+ impl < T > PortWriteOnly < T > {
147
+ /// Creates a write only I/O port with the given port number.
148
+ #[ inline]
149
+ pub const fn new ( port : u16 ) -> PortWriteOnly < T > {
150
+ PortWriteOnly {
151
+ port,
152
+ phantom : PhantomData ,
155
153
}
156
154
}
155
+ }
157
156
157
+ impl < T : PortWrite > PortWriteOnly < T > {
158
158
/// Writes to the port.
159
159
///
160
160
/// ## Safety
@@ -167,18 +167,18 @@ impl<T: PortWrite> PortWriteOnly<T> {
167
167
}
168
168
}
169
169
170
- impl < T : PortReadWrite > Port < T > {
171
- const_fn ! {
172
- /// Creates an I/O port with the given port number.
173
- #[ inline]
174
- pub fn new( port: u16 ) -> Port <T > {
175
- Port {
176
- port,
177
- phantom: PhantomData ,
178
- }
170
+ impl < T > Port < T > {
171
+ /// Creates an I/O port with the given port number.
172
+ #[ inline]
173
+ pub const fn new ( port : u16 ) -> Port < T > {
174
+ Port {
175
+ port,
176
+ phantom : PhantomData ,
179
177
}
180
178
}
179
+ }
181
180
181
+ impl < T : PortReadWrite > Port < T > {
182
182
/// Reads from the port.
183
183
///
184
184
/// ## Safety
0 commit comments