docs: use top-level RowCount & show types

This commit is contained in:
rzmk 2024-06-20 16:47:39 -04:00
parent 9de1541773
commit 786d0f38ba
No known key found for this signature in database
2 changed files with 6 additions and 9 deletions

View file

@ -23,17 +23,14 @@ cargo install czv
use czv::{RowCount, Result}; use czv::{RowCount, Result};
fn main() -> Result<()> { fn main() -> Result<()> {
let data = "\ let data: &str = "\
fruits,price fruits,price
apple,2.50 apple,2.50
banana,3.00 banana,3.00
strawberry,1.50 strawberry,1.50
"; ";
let output = RowCount::new() let output: usize = RowCount::new().file_data(data).execute()?;
.file_data(data) println!("{output}"); // 3
.include_header_row(true)
.execute()?;
println!("{output}"); // 4
Ok(()) Ok(())
} }
``` ```

View file

@ -1,13 +1,13 @@
use czv::{count::RowCount, Result}; use czv::{Result, RowCount};
fn main() -> Result<()> { fn main() -> Result<()> {
let data = "\ let data: &str = "\
fruits,price fruits,price
apple,2.50 apple,2.50
banana,3.00 banana,3.00
strawberry,1.50 strawberry,1.50
"; ";
let output = RowCount::new().file_data(data).execute()?; let output: usize = RowCount::new().file_data(data).execute()?;
println!("{output}"); // 3 println!("{output}"); // 3
Ok(()) Ok(())
} }