Do not duplicate NDJson when unecessary

This commit is contained in:
Kerollmops 2024-12-10 19:19:27 +01:00
parent e974be9518
commit d683f5980c
No known key found for this signature in database
GPG key ID: F250A4C4E3AE5F5F
3 changed files with 98 additions and 58 deletions

View file

@ -136,6 +136,14 @@ pub struct File {
}
impl File {
pub fn from_parts(path: PathBuf, file: Option<NamedTempFile>) -> Self {
Self { path, file }
}
pub fn into_parts(self) -> (PathBuf, Option<NamedTempFile>) {
(self.path, self.file)
}
pub fn dry_file() -> Result<Self> {
Ok(Self { path: PathBuf::new(), file: None })
}