Skip to content

Commit

Permalink
fix bindings: java, nodejs, python
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorgan committed Jan 19, 2025
1 parent 8337e0e commit 111c05d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
8 changes: 6 additions & 2 deletions bindings/java/src/async_operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fn intern_write(
}

async fn do_write(op: &mut Operator, path: String, content: Vec<u8>) -> Result<()> {
Ok(op.write(&path, content).await?)
Ok(op.write(&path, content).await.map(|_| ())?)
}

/// # Safety
Expand Down Expand Up @@ -182,7 +182,11 @@ fn intern_append(
}

async fn do_append(op: &mut Operator, path: String, content: Vec<u8>) -> Result<()> {
Ok(op.write_with(&path, content).append(true).await?)
Ok(op
.write_with(&path, content)
.append(true)
.await
.map(|_| ())?)
}

/// # Safety
Expand Down
2 changes: 1 addition & 1 deletion bindings/java/src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn intern_write(
) -> Result<()> {
let path = jstring_to_string(env, &path)?;
let content = env.convert_byte_array(content)?;
Ok(op.write(&path, content)?)
Ok(op.write(&path, content).map(|_| ())?)
}

/// # Safety
Expand Down
8 changes: 4 additions & 4 deletions bindings/nodejs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl Operator {
writer = writer.cache_control(cache_control);
}
}
writer.await.map_err(format_napi_error)
writer.await.map(|_| ()).map_err(format_napi_error)
}

//noinspection DuplicatedCode
Expand Down Expand Up @@ -371,7 +371,7 @@ impl Operator {
writer = writer.cache_control(cache_control);
}
}
writer.call().map_err(format_napi_error)
writer.call().map(|_| ()).map_err(format_napi_error)
}

/// Copy file according to given `from` and `to` path.
Expand Down Expand Up @@ -809,7 +809,7 @@ impl BlockingWriter {
/// ```
#[napi]
pub unsafe fn close(&mut self) -> Result<()> {
self.0.close().map_err(format_napi_error)
self.0.close().map(|_| ()).map_err(format_napi_error)
}
}

Expand Down Expand Up @@ -855,7 +855,7 @@ impl Writer {
/// ```
#[napi]
pub async unsafe fn close(&mut self) -> Result<()> {
self.0.close().await.map_err(format_napi_error)
self.0.close().await.map(|_| ()).map_err(format_napi_error)
}
}

Expand Down
4 changes: 2 additions & 2 deletions bindings/python/src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl Operator {
write = write.cache_control(cache_control);
}

write.call().map_err(format_pyerr)
write.call().map(|_| ()).map_err(format_pyerr)
}

/// Get current path's metadata **without cache** directly.
Expand Down Expand Up @@ -351,7 +351,7 @@ impl AsyncOperator {
if let Some(cache_control) = &kwargs.cache_control {
write = write.cache_control(cache_control);
}
write.await.map_err(format_pyerr)
write.await.map(|_| ()).map_err(format_pyerr)
})
}

Expand Down

0 comments on commit 111c05d

Please sign in to comment.