vortex_io/tokio.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use std::io;
5
6use tokio::io::AsyncWriteExt;
7
8use crate::IoBuf;
9use crate::VortexWrite;
10
11impl VortexWrite for tokio::fs::File {
12 async fn write_all<B: IoBuf>(&mut self, buffer: B) -> io::Result<B> {
13 AsyncWriteExt::write_all(self, buffer.as_slice()).await?;
14 Ok(buffer)
15 }
16
17 async fn flush(&mut self) -> io::Result<()> {
18 AsyncWriteExt::flush(self).await
19 }
20
21 async fn shutdown(&mut self) -> io::Result<()> {
22 AsyncWriteExt::shutdown(self).await
23 }
24}