Small, composable Rust 2024 helpers for structured data formats and document primitives.
use-data focuses on lightweight inspection, formatting, escaping, detection, and metadata helpers for JSON, TOML, YAML, CSV, and XML. The set is aimed at docs tooling, configuration helpers, fixtures, CLI support code, and application scaffolding where full parser stacks would be excessive.
Warning: crates in this workspace are experimental while they remain below
0.3.0. Expect API refinement as the set grows.
use-data: feature-gated umbrella crate for the full setuse-json: lightweight JSON detection, quoting, escaping, and compaction helpersuse-toml: TOML table and key-value extraction helpersuse-yaml: YAML marker, indentation, and key-value helpersuse-csv: basic CSV delimiter detection, row splitting, and field escaping helpersuse-xml: XML declaration, element, attribute, escaping, and comment helpers
- small utilities for common data-oriented formats
- predictable string-based helpers that avoid panics
- lightweight building blocks for fixtures, docs tooling, and config tooling
- conservative APIs that remain useful without full parsing frameworks
- replacing
serde_json,toml,serde_yaml,csv,quick-xml, or similar mature crates - full serialization or deserialization frameworks
- schema validation, path query languages, or streaming parsers
- domain-specific wrappers that belong in higher-level crates
[dependencies]
use-data = { version = "0.1", default-features = false, features = ["json", "yaml", "xml"] }use use_data::json::{JsonKind, compact_json_basic, detect_json_kind};
use use_data::xml::extract_root_element;
use use_data::yaml::extract_yaml_key_values;
let compact = compact_json_basic("{ \"name\": \"RustUse\", \"ok\": true }");
let kind = detect_json_kind("[1, 2, 3]");
let root = extract_root_element("<config mode=\"dev\" enabled=\"true\" />").unwrap();
let keys = extract_yaml_key_values("name: RustUse\nenabled: true\n");
assert_eq!(compact, "{\"name\":\"RustUse\",\"ok\":true}");
assert_eq!(kind, JsonKind::Array);
assert_eq!(root.name, "config");
assert_eq!(keys.len(), 2);Licensed under either of the following, at your option:
- MIT License
- Apache License, Version 2.0