Run cargo fmt

This commit is contained in:
Austen Adler 2023-11-15 23:29:34 -05:00
parent 2ea91652b7
commit d083b93f08
3 changed files with 11 additions and 12 deletions

View File

@ -2,10 +2,14 @@ use std::io::Write;
use crate::types;
use anyhow::Result;
use ncdufmt::{MajorVersion, MinorVersion, HeaderMetadata, InfoBlock, NcduFile, Directory, FileOrDirectory};
use ncdufmt::{
Directory, FileOrDirectory, HeaderMetadata, InfoBlock, MajorVersion, MinorVersion, NcduFile,
};
/// Builds an ncdu file from a stream
pub fn build_ncdu_file(rx: crossbeam::channel::Receiver<types::Entry>/*, _writer: impl Write*/) -> Result<NcduFile> {
pub fn build_ncdu_file(
rx: crossbeam::channel::Receiver<types::Entry>, /*, _writer: impl Write*/
) -> Result<NcduFile> {
let mut ret = NcduFile {
major_version: MajorVersion::default(),
minor_version: MinorVersion::default(),
@ -13,20 +17,18 @@ pub fn build_ncdu_file(rx: crossbeam::channel::Receiver<types::Entry>/*, _writer
contents: Directory {
info: InfoBlock::new("test-filename.tar".to_string()),
contents: Vec::default(),
}
},
};
while let Ok(entry) = rx.recv() {
let mut e = InfoBlock::new(entry.path.to_string_lossy());
e.asize = entry.size;
ret.contents.contents.push(FileOrDirectory::File(e) );
ret.contents.contents.push(FileOrDirectory::File(e));
}
Ok(ret)
}
#[cfg(test)]
mod tests {
use std::fs::File;

View File

@ -1,6 +1,6 @@
mod collector;
mod tar;
mod types;
mod collector;
fn main() {
println!("Hello, world!");

View File

@ -8,10 +8,7 @@ use tar::Archive;
/// Sends tar entries to a channel
///
/// The tar file must be in a decompressed state
pub fn get_entries(
tx: crossbeam::channel::Sender<types::Entry>,
reader: impl Read,
) -> Result<()> {
pub fn get_entries(tx: crossbeam::channel::Sender<types::Entry>, reader: impl Read) -> Result<()> {
let mut archive = Archive::new(reader);
for entry in archive.entries()? {