From d0fc4f6709a3ea9dfea9522104c2455d26eed65c Mon Sep 17 00:00:00 2001 From: TheTollingBell Date: Wed, 15 Oct 2025 10:30:05 -0400 Subject: [PATCH] feat: allow creating `File` with `PathBuf` --- src/file/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/file/mod.rs b/src/file/mod.rs index 72e0a361..02eda4bd 100644 --- a/src/file/mod.rs +++ b/src/file/mod.rs @@ -62,6 +62,15 @@ where source: FileSourceFile::new(name.into()), } } + + /// Identical to [`Self::new()`], but allows for using an owned [`PathBuf`]. + pub fn with_path(path: PathBuf, format: F) -> Self { + Self { + format: Some(format), + required: true, + source: FileSourceFile::new(path), + } + } } impl File {