fn write_ubuntu_data_tar_file<R: Read>(
    data_tar_bytes: R,
    file_name: &str,
    out_path: &Path,
) -> Result<()> {
    let mut data_tar = tar::Archive::new(data_tar_bytes);
    let mut entry = data_tar
        .entries()
        .context(DataEntriesSnafu)?
        .find(|entry| tar_entry_matches(entry, file_name))
        .context(FileNotFoundSnafu)?
        .context(ReadSnafu)?;
    let mut out_file = File::create(out_path).context(CreateSnafu)?;
    copy(&mut entry, &mut out_file).context(WriteSnafu)?;
    Ok(())
}
/// Given the bytes of a data.tar in a glibc deb package, find a file inside it,
/// and extract the file.
Given the bytes of a data.tar in a glibc deb package, find a file inside it,
and extract the file.
Given the bytes of a data . tar in a glibc deb package find a file inside it and extract the file .
fn write_ubuntu_data_tar_file<R: Read>(
    data_tar_bytes: R,
    file_name: &str,
    out_path: &Path,
) -> Result<()> {
    let mut data_tar = tar::Archive::new(data_tar_bytes);
    let mut entry = data_tar
        .entries()
        .context(DataEntriesSnafu)?
        .find(|entry| tar_entry_matches(entry, file_name))
        .context(FileNotFoundSnafu)?
        .context(ReadSnafu)?;
    let mut out_file = File::create(out_path).context(CreateSnafu)?;
    copy(&mut entry, &mut out_file).context(WriteSnafu)?;
    Ok(())
}
fn write_ubuntu_data_tar_file < R : Read > ( data_tar_bytes : R , file_name : & str , out_path : & Path , ) -> Result < ( ) > { let mut data_tar = tar :: Archive :: new ( data_tar_bytes ) ; let mut entry = data_tar . entries ( ) . context ( DataEntriesSnafu ) ? . find ( | entry | tar_entry_matches ( entry , file_name ) ) . context ( FileNotFoundSnafu ) ? . context ( ReadSnafu ) ? ; let mut out_file = File :: create ( out_path ) . context ( CreateSnafu ) ? ; copy ( & mut entry , & mut out_file ) . context ( WriteSnafu ) ? ; Ok ( ( ) ) }
Given the bytes of a data.tar in a glibc deb package, find a file inside it,
and extract the file.
Given the bytes of a data . tar in a glibc deb package find a file inside it and extract the file .
data_tar_bytes
R
file_name
&str
out_path
&Path
data_tar_bytes
R
file_name
&str
out_path
&Path