Run cargo fmt
This commit is contained in:
parent
2ea91652b7
commit
d083b93f08
@ -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;
|
||||
|
@ -1,6 +1,6 @@
|
||||
mod collector;
|
||||
mod tar;
|
||||
mod types;
|
||||
mod collector;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
|
@ -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()? {
|
||||
|
Loading…
Reference in New Issue
Block a user