Skip to content

Commit

Permalink
Add tokio File::options wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Jan 18, 2025
1 parent 55ff084 commit d7584cd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/tokio/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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`].
Expand Down

0 comments on commit d7584cd

Please sign in to comment.