pub fn recv_foreach<F: FnMut(T)>(&mut self, mut count: usize, mut f: F) -> Status {
        loop {
            let status = self.recv(|p, c| {
                let mut j = 0;
                while j < c && count > 0 {
                    f(unsafe { ptr::read(p.offset(j as isize)) });
                    count -= 1;
                    j += 1;
                };
                j
            }).unwrap();
            if status.remaining == 0 || count == 0 { return status; }
        }
    }
/// "Safe" version of recv. Will call your closure up to "count" times
/// and depend on optimisation to avoid memory copies.
///
/// # Panics
///
/// Panics in case the buffer is corrupt.
"Safe" version of recv. Will call your closure up to "count" times
and depend on optimisation to avoid memory copies.
" Safe " version of recv . Will call your closure up to " count " times and depend on optimisation to avoid memory copies .
pub fn recv_foreach<F: FnMut(T)>(&mut self, mut count: usize, mut f: F) -> Status {
        loop {
            let status = self.recv(|p, c| {
                let mut j = 0;
                while j < c && count > 0 {
                    f(unsafe { ptr::read(p.offset(j as isize)) });
                    count -= 1;
                    j += 1;
                };
                j
            }).unwrap();
            if status.remaining == 0 || count == 0 { return status; }
        }
    }
pub fn recv_foreach < F : FnMut ( T ) > ( & mut self , mut count : usize , mut f : F ) -> Status { loop { let status = self . recv ( | p , c | { let mut j = 0 ; while j < c && count > 0 { f ( unsafe { ptr :: read ( p . offset ( j as isize ) ) } ) ; count -= 1 ; j += 1 ; } ; j } ) . unwrap ( ) ; if status . remaining == 0 || count == 0 { return status ; } } }
"Safe" version of recv.
" Safe " version of recv .
&mut self
count
usize
f
F
&mut self
count
usize
f
F
panics
Panics in case the buffer is corrupt.
Panics in case the buffer is corrupt .