Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RustUse/use-data

RustUse use-data

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.

Crate List

  • use-data: feature-gated umbrella crate for the full set
  • use-json: lightweight JSON detection, quoting, escaping, and compaction helpers
  • use-toml: TOML table and key-value extraction helpers
  • use-yaml: YAML marker, indentation, and key-value helpers
  • use-csv: basic CSV delimiter detection, row splitting, and field escaping helpers
  • use-xml: XML declaration, element, attribute, escaping, and comment helpers

Scope

  • 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

Non-Goals

  • 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

Example Usage

[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);

License

Licensed under either of the following, at your option:

  • MIT License
  • Apache License, Version 2.0

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors