Skip to content

stdlib/dataView source ↗

data

10 items · generated by scribe fromstdlib/data.fd· synced 2026-11-15

stdlib/data10 items

Contents

load_csv

CSV data — stored as a JSON array of objects (one per row). Each object has keys = column headers, values = string cells. This format works with the existing json module. Load a CSV file and parse it into a JSON array of row objects. The first line is treated as the header row. Returns a JSON string: [{“col1”:“val1”,“col2”:“val2”}, …]

pub fn load_csv(path: str) -> str {

Parameters:

  • path: str

Returns: str

Defined at line 29


parse_csv

Parse CSV text into a JSON array of row objects. Handles quoted fields with commas, but not multi-line quoted fields.

pub fn parse_csv(content: str) -> str {

Parameters:

  • content: str

Returns: str

Defined at line 39


parse_csv_row

Parse a single CSV row into a Vec of cell values. Handles quoted fields: “hello, world” → hello, world

pub fn parse_csv_row(line: str) -> Vec<str> {

Parameters:

  • line: str

Returns: Vec<str>

Defined at line 83


csv_headers

Get the column headers from a parsed CSV (as JSON array of objects). Returns a JSON array of header strings.

pub fn csv_headers(csv_json: str) -> str {

Parameters:

  • csv_json: str

Returns: str

Defined at line 118


csv_row

Get a specific row from a parsed CSV. Returns a JSON object with column→value mappings.

pub fn csv_row(csv_json: str, row_idx: i64) -> str {

Parameters:

  • csv_json: str
  • row_idx: i64

Returns: str

Defined at line 137


csv_get

Get a cell value from a CSV row by column name.

pub fn csv_get(row_json: str, col_name: str) -> str {

Parameters:

  • row_json: str
  • col_name: str

Returns: str

Defined at line 142


csv_row_count

Get the number of rows in a parsed CSV.

pub fn csv_row_count(csv_json: str) -> i64 {

Parameters:

  • csv_json: str

Returns: i64

Defined at line 147


load_json

Load a JSON file and return the parsed JSON string. "" when the file cannot be read.

pub fn load_json(path: str) -> str {

Parameters:

  • path: str

Returns: str

Defined at line 155


json_get_value

Get a value from a JSON object by key.

pub fn json_get_value(json_str: str, key: str) -> str {

Parameters:

  • json_str: str
  • key: str

Returns: str

Defined at line 161


infer_json_schema

Infer the “schema” of a JSON object — return a description of the types of each top-level key. Returns a JSON object mapping keys to type names: {“name”:“string”,“age”:“number”,“active”:“boolean”}

pub fn infer_json_schema(json_str: str) -> str {

Parameters:

  • json_str: str

Returns: str

Defined at line 168


Generated by scribe, the Fides documentation generator