Use Vec<String> for files list rather than Vec<&str> to simplify code

This commit is contained in:
Nathan Fisher 2023-07-06 18:46:11 -04:00
parent d303eb0390
commit 04d2fb2bf4

View File

@ -31,7 +31,7 @@ pub use {
};
/// Creates a haggis archive from a list of files
pub fn create_archive(path: &str, files: Vec<&str>, algorithm: Algorithm) -> Result<(), Error> {
pub fn create_archive(path: &str, files: Vec<String>, algorithm: Algorithm) -> Result<(), Error> {
let fd = fs::OpenOptions::new()
.create(true)
.truncate(true)
@ -44,7 +44,7 @@ pub fn create_archive(path: &str, files: Vec<&str>, algorithm: Algorithm) -> Res
/// Streams a haggis archive over something which implements `Write`
pub fn stream_archive<W: Write>(
mut writer: W,
files: Vec<&str>,
files: Vec<String>,
algorithm: Algorithm,
) -> Result<(), Error> {
let links = Mutex::new(HashMap::new());
@ -69,7 +69,7 @@ pub enum Message {
#[cfg(feature = "parallel")]
pub fn par_create_archive(
path: &str,
files: Vec<&str>,
files: Vec<String>,
algorithm: Algorithm,
sender: &Sender<Message>,
) -> Result<(), Error> {
@ -83,7 +83,7 @@ pub fn par_create_archive(
#[cfg(feature = "parallel")]
pub fn par_stream_archive<W: Write + Send>(
writer: W,
files: Vec<&str>,
files: Vec<String>,
algorithm: Algorithm,
sender: &Sender<Message>,
) -> Result<(), Error> {