aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-08-24 12:46:05 -0400
committerDeterminant <[email protected]>2020-08-24 12:46:05 -0400
commit5a578e4dac2721b324aff1665b7d2afbe00b5fb3 (patch)
tree03f8a3ea2c7adee04e99b86dd930d8072a76783f /src
parent33070682dcf1ec0bf9b22cd2ea38cf983a628f7d (diff)
bump the version of libaio-futuresv0.1.4
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 45d4843..be8993b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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 })
+ })
}
}