Writer for tar nodes takes &self instead of self

This commit is contained in:
Nathan Fisher 2023-04-11 22:03:09 -04:00
parent 407d12a711
commit e0f497cb89

View File

@ -23,11 +23,11 @@ impl Node {
/// Write out a single file within the tar to a file or something with a
/// ``std::io::Write`` trait.
pub fn write<T: io::Write>(self, mut input: T) -> Result<usize, Error> {
pub fn write<T: io::Write>(&self, mut input: T) -> Result<usize, Error> {
input.write_all(&self.header.to_bytes()?)?;
let mut written = 512;
for d in self.data {
input.write_all(&d)?;
for d in &self.data {
input.write_all(d)?;
written += d.len();
}