@@ -152,16 +152,14 @@ impl SimpleNetwork {
152
152
let mut stats_table: NetworkStats = Default :: default ( ) ;
153
153
let mut stats_size = core:: mem:: size_of :: < NetworkStats > ( ) ;
154
154
let status = ( self . statistics ) ( self , false , Some ( & mut stats_size) , Some ( & mut stats_table) ) ;
155
- Result :: from ( status) ?;
156
- Ok ( stats_table)
155
+ status. into_with_val ( || stats_table)
157
156
}
158
157
159
158
/// Convert a multicast IP address to a multicast HW MAC Address.
160
159
pub fn mcast_ip_to_mac ( & self , ipv6 : bool , ip : IpAddress ) -> Result < MacAddress > {
161
160
let mut mac_address = MacAddress ( [ 0 ; 32 ] ) ;
162
161
let status = ( self . mcast_ip_to_mac ) ( self , ipv6, & ip, & mut mac_address) ;
163
- Result :: from ( status) ?;
164
- Ok ( mac_address)
162
+ status. into_with_val ( || mac_address)
165
163
}
166
164
167
165
/// Perform read operations on the NVRAM device attached to
@@ -194,17 +192,15 @@ impl SimpleNetwork {
194
192
pub fn get_interrupt_status ( & self ) -> Result < InterruptStatus > {
195
193
let mut interrupt_status = InterruptStatus :: empty ( ) ;
196
194
let status = ( self . get_status ) ( self , Some ( & mut interrupt_status) , None ) ;
197
- Result :: from ( status) ?;
198
- Ok ( interrupt_status)
195
+ status. into_with_val ( || interrupt_status)
199
196
}
200
197
201
198
/// Read the current recycled transmit buffer status from a
202
199
/// network interface.
203
200
pub fn get_recycled_transmit_buffer_status ( & self ) -> Result < Option < NonNull < u8 > > > {
204
201
let mut tx_buf: * mut c_void = ptr:: null_mut ( ) ;
205
202
let status = ( self . get_status ) ( self , None , Some ( & mut tx_buf) ) ;
206
- Result :: from ( status) ?;
207
- Ok ( NonNull :: new ( tx_buf. cast ( ) ) )
203
+ status. into_with_val ( || NonNull :: new ( tx_buf. cast ( ) ) )
208
204
}
209
205
210
206
/// Place a packet in the transmit queue of a network interface.
@@ -249,8 +245,7 @@ impl SimpleNetwork {
249
245
dest_addr,
250
246
protocol,
251
247
) ;
252
- Result :: from ( status) ?;
253
- Ok ( buffer_size)
248
+ status. into_with_val ( || buffer_size)
254
249
}
255
250
256
251
/// Event that fires once a packet is available to be received.
0 commit comments