From d7584cd221674d0dcf43c7af704045f1611f0e47 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 18 Jan 2025 14:24:07 +0100 Subject: [PATCH] Add tokio File::options wrapper --- src/tokio/file.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tokio/file.rs b/src/tokio/file.rs index be13e18..3308a2c 100644 --- a/src/tokio/file.rs +++ b/src/tokio/file.rs @@ -9,6 +9,8 @@ use tokio::fs; use tokio::fs::File as TokioFile; use tokio::io::{AsyncRead, AsyncSeek, AsyncWrite, ReadBuf}; +use super::OpenOptions; + /// Wrapper around [`tokio::fs::File`] which adds more helpful /// information to all errors. #[derive(Debug)] @@ -52,6 +54,13 @@ impl File { } } + /// Returns a new `OpenOptions` object. + /// + /// Wrapper for [`tokio::fs::File::options`]. + pub fn options() -> OpenOptions { + OpenOptions::new() + } + /// Converts a [`crate::File`] to a [`tokio::fs::File`]. /// /// Wrapper for [`tokio::fs::File::from_std`].