diff options
author | Determinant <[email protected]> | 2020-08-24 12:46:05 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-08-24 12:46:05 -0400 |
commit | 5a578e4dac2721b324aff1665b7d2afbe00b5fb3 (patch) | |
tree | 03f8a3ea2c7adee04e99b86dd930d8072a76783f /src | |
parent | 33070682dcf1ec0bf9b22cd2ea38cf983a628f7d (diff) |
bump the version of libaio-futuresv0.1.4
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 29 |
1 files changed, 13 insertions, 16 deletions
@@ -107,17 +107,14 @@ impl WALFile for WALFileAIO { } async fn write(&self, offset: WALPos, data: WALBytes) -> Result<(), ()> { - self.aiomgr - .write(self.fd, offset, data, None) - .await - .or_else(|_| Err(())) - .and_then(|(nwrote, data)| { - if nwrote == data.len() { - Ok(()) - } else { - Err(()) - } - }) + let (res, data) = self.aiomgr.write(self.fd, offset, data, None).await; + res.or_else(|_| Err(())).and_then(|nwrote| { + if nwrote == data.len() { + Ok(()) + } else { + Err(()) + } + }) } fn read( @@ -125,11 +122,11 @@ impl WALFile for WALFileAIO { offset: WALPos, length: usize, ) -> Result<Option<WALBytes>, ()> { - block_on(self.aiomgr.read(self.fd, offset, length, None)) - .or_else(|_| Err(())) - .and_then(|(nread, data)| { - Ok(if nread == length { Some(data) } else { None }) - }) + let (res, data) = + block_on(self.aiomgr.read(self.fd, offset, length, None)); + res.or_else(|_| Err(())).and_then(|nread| { + Ok(if nread == length { Some(data) } else { None }) + }) } } |