@@ -100,37 +100,37 @@ impl PortReadWrite for u32 {}
100100
101101/// A read only I/O port.
102102#[ derive( Debug , Clone , PartialEq , Eq ) ]
103- pub struct PortReadOnly < T : PortRead > {
103+ pub struct PortReadOnly < T > {
104104 port : u16 ,
105105 phantom : PhantomData < T > ,
106106}
107107
108108/// A write only I/O port.
109109#[ derive( Debug , Clone , PartialEq , Eq ) ]
110- pub struct PortWriteOnly < T : PortWrite > {
110+ pub struct PortWriteOnly < T > {
111111 port : u16 ,
112112 phantom : PhantomData < T > ,
113113}
114114
115115/// An I/O port.
116116#[ derive( Debug , Clone , PartialEq , Eq ) ]
117- pub struct Port < T : PortReadWrite > {
117+ pub struct Port < T > {
118118 port : u16 ,
119119 phantom : PhantomData < T > ,
120120}
121121
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 ,
131129 }
132130 }
131+ }
133132
133+ impl < T : PortRead > PortReadOnly < T > {
134134 /// Reads from the port.
135135 ///
136136 /// ## Safety
@@ -143,18 +143,18 @@ impl<T: PortRead> PortReadOnly<T> {
143143 }
144144}
145145
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 ,
155153 }
156154 }
155+ }
157156
157+ impl < T : PortWrite > PortWriteOnly < T > {
158158 /// Writes to the port.
159159 ///
160160 /// ## Safety
@@ -167,18 +167,18 @@ impl<T: PortWrite> PortWriteOnly<T> {
167167 }
168168}
169169
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 ,
179177 }
180178 }
179+ }
181180
181+ impl < T : PortReadWrite > Port < T > {
182182 /// Reads from the port.
183183 ///
184184 /// ## Safety
0 commit comments