@@ -74,7 +74,7 @@ pub fn compute_network_configuration<'a>(interfaces: &'a [NetworkInterface], sca
7474 Some ( name) => String :: from ( name) ,
7575 None => {
7676
77- let name = utils:: select_default_interface ( & interfaces) . map ( |interface| interface. name ) ;
77+ let name = utils:: select_default_interface ( interfaces) . map ( |interface| interface. name ) ;
7878
7979 match name {
8080 Some ( name) => name,
@@ -237,9 +237,14 @@ pub fn send_arp_request(tx: &mut Box<dyn DataLinkSender>, interface: &NetworkInt
237237 ethernet_packet. set_payload ( arp_packet. packet_mut ( ) ) ;
238238 }
239239
240- tx. send_to ( & ethernet_packet. to_immutable ( ) . packet ( ) , Some ( interface. clone ( ) ) ) ;
240+ tx. send_to ( ethernet_packet. to_immutable ( ) . packet ( ) , Some ( interface. clone ( ) ) ) ;
241241}
242242
243+ /**
244+ * A network iterator for iterating over multiple network ranges in with a
245+ * low-memory approach. This iterator was crafted to allow iteration over huge
246+ * network ranges (192.168.0.0/16) without consuming excessive memory.
247+ */
243248pub struct NetworkIterator {
244249 current_iterator : Option < ipnetwork:: IpNetworkIterator > ,
245250 networks : Vec < IpNetwork > ,
@@ -268,6 +273,11 @@ impl NetworkIterator {
268273 }
269274 }
270275
276+ /**
277+ * The functions below are not public and only used by the Iterator trait
278+ * to help keep the next() code clean.
279+ */
280+
271281 fn has_no_items_left ( & self ) -> bool {
272282 self . current_iterator . is_none ( ) && self . networks . is_empty ( ) && self . random_pool . is_empty ( )
273283 }
@@ -391,7 +401,7 @@ pub fn receive_arp_responses(rx: &mut Box<dyn DataLinkReceiver>, options: Arc<Sc
391401 } ;
392402 packet_count += 1 ;
393403
394- let ethernet_packet = match EthernetPacket :: new ( & arp_buffer[ .. ] ) {
404+ let ethernet_packet = match EthernetPacket :: new ( arp_buffer) {
395405 Some ( packet) => packet,
396406 None => continue
397407 } ;
0 commit comments