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, VortexWrite};
9
10impl VortexWrite for tokio::fs::File {
11 async fn write_all<B: IoBuf>(&mut self, buffer: B) -> io::Result<B> {
12 AsyncWriteExt::write_all(self, buffer.as_slice()).await?;
13 Ok(buffer)
14 }
15
16 async fn flush(&mut self) -> io::Result<()> {
17 AsyncWriteExt::flush(self).await
18 }
19
20 async fn shutdown(&mut self) -> io::Result<()> {
21 AsyncWriteExt::shutdown(self).await
22 }
23}