pub fn write_as_csv(&mut self, results: &[FileGroup<Path>]) -> io::Result<()> {
        let mut wtr = csv::WriterBuilder::new()
            .delimiter(b',')
            .quote_style(csv::QuoteStyle::Necessary)
            .flexible(true)
            .from_writer(&mut self.out);

        wtr.write_record(&["size", "hash", "count", "files"])?;
        for g in results {
            let mut record = csv::StringRecord::new();
            record.push_field(g.len.0.to_string().as_str());
            record.push_field(
                g.hash
                    .map(|h| h.to_string())
                    .unwrap_or_else(|| "".to_string())
                    .as_str(),
            );
            record.push_field(g.files.len().to_string().as_str());
            for f in g.files.iter() {
                record.push_field(f.to_string_lossy().as_ref());
            }
            wtr.write_record(&record)?;
        }
        wtr.flush()
    }
/// Writes results in CSV format.
/// Each file group is written as one line.
/// The number of columns is dynamic.
/// Columns:
/// - file size in bytes
/// - file hash (may be empty)
/// - number of files in the group
/// - file paths - each file in a separate column
Writes results in CSV format.
Each file group is written as one line.
The number of columns is dynamic.
Columns:
file size in bytes
file hash (may be empty)
number of files in the group
file paths - each file in a separate column
Writes results in CSV format . Each file group is written as one line . The number of columns is dynamic . Columns : file size in bytes file hash ( may be empty ) number of files in the group file paths - each file in a separate column
pub fn write_as_csv(&mut self, results: &[FileGroup<Path>]) -> io::Result<()> {
        let mut wtr = csv::WriterBuilder::new()
            .delimiter(b',')
            .quote_style(csv::QuoteStyle::Necessary)
            .flexible(true)
            .from_writer(&mut self.out);
        wtr.write_record(&["size", "hash", "count", "files"])?;
        for g in results {
            let mut record = csv::StringRecord::new();
            record.push_field(g.len.0.to_string().as_str());
            record.push_field(
                g.hash
                    .map(|h| h.to_string())
                    .unwrap_or_else(|| "".to_string())
                    .as_str(),
            );
            record.push_field(g.files.len().to_string().as_str());
            for f in g.files.iter() {
                record.push_field(f.to_string_lossy().as_ref());
            }
            wtr.write_record(&record)?;
        }
        wtr.flush()
    }
pub fn write_as_csv ( & mut self , results : & [ FileGroup < Path > ] ) -> io :: Result < ( ) > { let mut wtr = csv :: WriterBuilder :: new ( ) . delimiter ( b',' ) . quote_style ( csv :: QuoteStyle :: Necessary ) . flexible ( true ) . from_writer ( & mut self . out ) ; wtr . write_record ( & [ " " , " " , " " , " " ] ) ? ; for g in results { let mut record = csv :: StringRecord :: new ( ) ; record . push_field ( g . len . 0 . to_string ( ) . as_str ( ) ) ; record . push_field ( g . hash . map ( | h | h . to_string ( ) ) . unwrap_or_else ( | | " " . to_string ( ) ) . as_str ( ) , ) ; record . push_field ( g . files . len ( ) . to_string ( ) . as_str ( ) ) ; for f in g . files . iter ( ) { record . push_field ( f . to_string_lossy ( ) . as_ref ( ) ) ; } wtr . write_record ( & record ) ? ; } wtr . flush ( ) }
Writes results in CSV format.
Writes results in CSV format .
&mut self
results
&[FileGroup<Path>]
&mut self
results
&[FileGroup<Path>]