Skip to main content

Crate use_csv

Crate use_csv 

Source
Expand description

§use-csv

Practical CSV utility primitives for lightweight delimiter detection, field escaping, and row splitting.

Warning: versions below 0.3.0 are experimental and may change as the crate matures.

§Example Usage

use use_csv::{csv_join_row, detect_delimiter, parse_csv_basic, split_csv_line_basic};

let rows = parse_csv_basic("name,enabled\nRustUse,true\n");

assert_eq!(detect_delimiter("name;enabled\nRustUse;true\n"), Some(';'));
assert_eq!(split_csv_line_basic("a,\"b,c\",d"), vec!["a", "b,c", "d"]);
assert_eq!(rows[1].fields[0], "RustUse");
assert_eq!(csv_join_row(&["one", "two,three"]), "one,\"two,three\"");

§Scope

  • common delimiter detection for comma, tab, semicolon, and pipe separated data
  • conservative quoted-field splitting
  • lightweight row parsing for fixtures, CLIs, docs, and config helpers

§Non-Goals

  • full RFC 4180 support
  • streaming CSV parsing
  • encoding detection

§License

Licensed under either of the following, at your option:

  • MIT License
  • Apache License, Version 2.0

Structs§

CsvDialect
Basic dialect metadata for simple CSV handling.
CsvRow
A parsed CSV row.

Functions§

count_csv_columns
Counts columns in a CSV-like line using the basic splitter.
csv_escape_field
Escapes a field for comma-separated output.
csv_join_row
Joins fields into a comma-separated row.
detect_delimiter
Detects the most likely delimiter from common candidates.
looks_like_csv
Returns true when the input looks like delimiter-separated data.
parse_csv_basic
Parses CSV-like input into rows without streaming or encoding support.
split_csv_line_basic
Splits a single CSV line using a detected delimiter or a comma fallback.