pub fn run(self) {
        unsafe {
            let mut ret = Ok(0);
            if self.op == IOOperation::Truncate {
                ret = self
                    .fd
                    .truncate(self.offset)
                    .map_err(|e| Error::Io(Box::new(e)))
                    .map(|_| 0);
            } else if self.data_size > 0 {
                let buf = slice::from_raw_parts(self.ptr, self.data_size);
                ret = self
                    .fd
                    .write(self.offset, buf)
                    .map_err(|e| Error::Io(Box::new(e)));
            }
            if ret.is_ok() && self.op == IOOperation::Fsync {
                if let Err(e) = self.fd.sync() {
                    ret = Err(Error::Io(Box::new(e)));
                }
            }
            let _ = self.cb.send(ret);
        }
    }
// Do not call it self again
Do not call it self again
Do not call it self again
pub fn run(self) {
        unsafe {
            let mut ret = Ok(0);
            if self.op == IOOperation::Truncate {
                ret = self
                    .fd
                    .truncate(self.offset)
                    .map_err(|e| Error::Io(Box::new(e)))
                    .map(|_| 0);
            } else if self.data_size > 0 {
                let buf = slice::from_raw_parts(self.ptr, self.data_size);
                ret = self
                    .fd
                    .write(self.offset, buf)
                    .map_err(|e| Error::Io(Box::new(e)));
            }
            if ret.is_ok() && self.op == IOOperation::Fsync {
                if let Err(e) = self.fd.sync() {
                    ret = Err(Error::Io(Box::new(e)));
                }
            }
            let _ = self.cb.send(ret);
        }
    }
pub fn run ( self ) { unsafe { let mut ret = Ok ( 0 ) ; if self . op == IOOperation :: Truncate { ret = self . fd . truncate ( self . offset ) . map_err ( | e | Error :: Io ( Box :: new ( e ) ) ) . map ( | _ | 0 ) ; } else if self . data_size > 0 { let buf = slice :: from_raw_parts ( self . ptr , self . data_size ) ; ret = self . fd . write ( self . offset , buf ) . map_err ( | e | Error :: Io ( Box :: new ( e ) ) ) ; } if ret . is_ok ( ) && self . op == IOOperation :: Fsync { if let Err ( e ) = self . fd . sync ( ) { ret = Err ( Error :: Io ( Box :: new ( e ) ) ) ; } } let _ = self . cb . send ( ret ) ; } }
Do not call it self again
Do not call it self again
self