spring_batch_rs/item/csv/
mod.rs

1/// This module provides functionality for reading CSV files.
2pub mod csv_reader;
3
4/// This module provides a CSV item writer implementation for Spring Batch.
5/// It allows writing items to a CSV file using the `ItemWriter` trait.
6///
7/// The `CsvItemWriter` struct is responsible for writing items to a CSV file.
8/// It uses the `csv` crate for CSV serialization and writing.
9///
10/// The `CsvItemWriterBuilder` struct is a builder for creating instances of `CsvItemWriter`.
11/// It allows configuring options such as the delimiter and whether to include headers in the CSV file.
12///
13/// Example usage:
14///
15/// ```rust
16/// use spring_batch_rs::item::csv::csv_writer::{CsvItemWriterBuilder, CsvItemWriter};
17/// use spring_batch_rs::core::item::{ItemWriter, ItemWriterResult};
18/// use serde::{Deserialize, Serialize};
19///
20/// #[derive(Serialize, Deserialize)]
21/// struct Person {
22///     name: String,
23///     age: u8,
24/// }
25///
26/// let writer = CsvItemWriterBuilder::new()
27///     .has_headers(true)
28///     .from_path("target/output.csv");
29///
30/// let people = vec![
31///     Person { name: "Alice".to_string(), age: 25 },
32///     Person { name: "Bob".to_string(), age: 30 },
33/// ];
34///
35/// writer.write(&people).unwrap();
36/// ```
37pub mod csv_writer;