From d23e488aaa7646ae4391e584e4bda1186a92f7d0 Mon Sep 17 00:00:00 2001 From: Bruce Leidl Date: Tue, 29 Jan 2019 13:42:17 -0500 Subject: [PATCH] method to write header to a path --- libcitadel/src/header.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libcitadel/src/header.rs b/libcitadel/src/header.rs index bb6b618..9df4bcc 100644 --- a/libcitadel/src/header.rs +++ b/libcitadel/src/header.rs @@ -1,5 +1,5 @@ use std::cell::RefCell; -use std::fs::File; +use std::fs::{File,OpenOptions}; use std::io::{Read, Write}; use std::path::Path; @@ -245,6 +245,10 @@ impl ImageHeader { Ok(()) } + pub fn write_header_to>(&self, path: P) -> Result<()> { + self.write_header(OpenOptions::new().write(true).open(path.as_ref())?) + } + pub fn clear(&self) { for b in &mut self.0.borrow_mut()[..] { *b = 0;