/// Return a vector of IO results. Each result return the `T` and
/// buffer used for IO so the caller can use it again, and the
/// actual result of the IO.
Return a vector of IO results. Each result return the `T` and
buffer used for IO so the caller can use it again, and the
actual result of the IO.
Return a vector of IO results . Each result return the ` T ` and buffer used for IO so the caller can use it again and the actual result of the IO .
pub fn results(&mut self, min: usize, max: usize, timeout: Option<Duration>)
                   -> io::Result<Vec<(IoOp<T, Wb, Rb>, io::Result<usize>)>> {
        let mut v : Vec<_> = (0..max).map(|_| Default::default()).collect();
        let r = unsafe {
            let mut ts = timeout.map(timespec_from_duration);
            aio::io_getevents(self.ctx.ctx, min as i64, max as i64, v.as_mut_ptr(), as_mut_ptr(ts.as_mut()))
        };
        if r < 0 {
            Err(io::Error::from_raw_os_error(-r))
        } else {
            v.truncate(r as usize);
            let ret = v.iter()
                .map(|ev| {
                    let evres = if ev.res < 0 {
                        Err(io::Error::from_raw_os_error(-ev.res as i32))
                    } else {
                        Ok(ev.res as usize)
                    };
                    let iocb = ev.data as *mut Iocb<T, Wb, Rb>;
                    self.submitted -= 1;
                    (self.batch.free_iocb(iocb).op, evres)
                })
                .collect();
            Ok(ret)
        }
    }
pub fn results ( & mut self , min : usize , max : usize , timeout : Option < Duration > ) -> io :: Result < Vec < ( IoOp < T , Wb , Rb > , io :: Result < usize > ) > > { let mut v : Vec < _ > = ( 0 .. max ) . map ( | _ | Default :: default ( ) ) . collect ( ) ; let r = unsafe { let mut ts = timeout . map ( timespec_from_duration ) ; aio :: io_getevents ( self . ctx . ctx , min as i64 , max as i64 , v . as_mut_ptr ( ) , as_mut_ptr ( ts . as_mut ( ) ) ) } ; if r < 0 { Err ( io :: Error :: from_raw_os_error ( - r ) ) } else { v . truncate ( r as usize ) ; let ret = v . iter ( ) . map ( | ev | { let evres = if ev . res < 0 { Err ( io :: Error :: from_raw_os_error ( - ev . res as i32 ) ) } else { Ok ( ev . res as usize ) } ; let iocb = ev . data as * mut Iocb < T , Wb , Rb > ; self . submitted -= 1 ; ( self . batch . free_iocb ( iocb ) . op , evres ) } ) . collect ( ) ; Ok ( ret ) } }
Return a vector of IO results.
Return a vector of IO results .
&mut self
min
usize
max
usize
timeout
Option<Duration>