use super::extract::{Error, Extract}; use std::{io::Read, path::Path}; pub struct TarXz { response: R, } impl TarXz { #[allow(dead_code)] pub fn new(response: R) -> Self { Self { response } } } impl Extract for TarXz { fn extract_into>(self, path: P) -> Result<(), Error> { let xz_stream = xz2::read::XzDecoder::new(self.response); let mut tar_archive = tar::Archive::new(xz_stream); tar_archive.unpack(&path)?; Ok(()) } }