Fix AsRawFd trait bound and error handling in ftruncate implementation

Co-Authored-By: christian@neon.tech <christian@neon.tech>
This commit is contained in:
Devin AI
2025-05-08 12:31:45 +00:00
parent 7eff80939e
commit 652bd403b8

View File

@@ -201,7 +201,7 @@ impl std::ops::Deref for Handle {
}
impl Handle {
pub async fn ftruncate<F: tokio_epoll_uring::IoFd + Send>(
pub async fn ftruncate<F: tokio_epoll_uring::IoFd + Send + std::os::unix::io::AsRawFd>(
&self,
file: F,
len: u64,
@@ -214,6 +214,6 @@ impl Handle {
let res = std_file.set_len(len);
let _ = std_file.into_raw_fd();
(file, res.map_err(tokio_epoll_uring::Error::Io))
(file, res.map_err(|e| tokio_epoll_uring::Error::System(e)))
}
}