pub fn iter<'a, 'b>(&'b mut self, mem: &'a GuestMemory) -> AvailIter<'a, 'b> {
        if !self.is_valid(mem) {
            return AvailIter::new(mem, &mut self.next_avail);
        }
        let queue_size = self.actual_size();
        let avail_ring = self.avail_ring;

        let index_addr = match mem.checked_offset(avail_ring, 2) {
            Some(ret) => ret,
            None => {
                // TODO log address
                warn!("Invalid offset");
                return AvailIter::new(mem, &mut self.next_avail);
            }
        };
        // Note that last_index has no invalid values
        let last_index: u16 = match mem.read_obj_from_addr::<u16>(index_addr) {
            Ok(ret) => ret,
            Err(_) => return AvailIter::new(mem, &mut self.next_avail),
        };

        AvailIter {
            mem: mem,
            desc_table: self.desc_table,
            avail_ring: avail_ring,
            next_index: self.next_avail,
            last_index: Wrapping(last_index),
            queue_size: queue_size,
            next_avail: &mut self.next_avail,
        }
    }
/// A consuming iterator over all available descriptor chain heads offered by the driver.
A consuming iterator over all available descriptor chain heads offered by the driver.
A consuming iterator over all available descriptor chain heads offered by the driver .
pub fn iter<'a, 'b>(&'b mut self, mem: &'a GuestMemory) -> AvailIter<'a, 'b> {
        if !self.is_valid(mem) {
            return AvailIter::new(mem, &mut self.next_avail);
        }
        let queue_size = self.actual_size();
        let avail_ring = self.avail_ring;
        let index_addr = match mem.checked_offset(avail_ring, 2) {
            Some(ret) => ret,
            None => {
                // TODO log address
                warn!("Invalid offset");
                return AvailIter::new(mem, &mut self.next_avail);
            }
        };
        // Note that last_index has no invalid values
        let last_index: u16 = match mem.read_obj_from_addr::<u16>(index_addr) {
            Ok(ret) => ret,
            Err(_) => return AvailIter::new(mem, &mut self.next_avail),
        };
        AvailIter {
            mem: mem,
            desc_table: self.desc_table,
            avail_ring: avail_ring,
            next_index: self.next_avail,
            last_index: Wrapping(last_index),
            queue_size: queue_size,
            next_avail: &mut self.next_avail,
        }
    }
pub fn iter < ' a , ' b > ( & ' b mut self , mem : & ' a GuestMemory ) -> AvailIter < ' a , ' b > { if ! self . is_valid ( mem ) { return AvailIter :: new ( mem , & mut self . next_avail ) ; } let queue_size = self . actual_size ( ) ; let avail_ring = self . avail_ring ; let index_addr = match mem . checked_offset ( avail_ring , 2 ) { Some ( ret ) => ret , None => { // TODO log address warn ! ( " " ) ; return AvailIter :: new ( mem , & mut self . next_avail ) ; } } ; // Note that last_index has no invalid values let last_index : u16 = match mem . read_obj_from_addr :: < u16 > ( index_addr ) { Ok ( ret ) => ret , Err ( _ ) => return AvailIter :: new ( mem , & mut self . next_avail ) , } ; AvailIter { mem : mem , desc_table : self . desc_table , avail_ring : avail_ring , next_index : self . next_avail , last_index : Wrapping ( last_index ) , queue_size : queue_size , next_avail : & mut self . next_avail , } }
A consuming iterator over all available descriptor chain heads offered by the driver.
A consuming iterator over all available descriptor chain heads offered by the driver .
&'b mut self
mem
&'a GuestMemory
&'b mut self
mem
&'a GuestMemory