mirror of
https://github.com/rzmk/czv.git
synced 2025-12-19 08:09:24 +00:00
docs: use top-level RowCount & show types
This commit is contained in:
parent
9de1541773
commit
786d0f38ba
2 changed files with 6 additions and 9 deletions
|
|
@ -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(())
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -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(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue