| Crates.io | mavec |
| lib.rs | mavec |
| version | 0.2.1 |
| created_at | 2025-01-06 14:24:58.949254+00 |
| updated_at | 2025-02-13 16:55:24.747585+00 |
| description | Converts an object-like json into a String vector. |
| homepage | https://github.com/Propfend/mavec |
| repository | https://github.com/Propfend/mavec |
| max_upload_size | |
| id | 1505634 |
| size | 10,615 |
mavec is a lightweight Rust library designed for transforming and handling Values data with ease.
It provides utilities for converting Json-like objects into flattened Vec<String> representations, enabling
seamless integration with applications that require efficient data processing, such as CLI tools, APIs, or data pipelines.
add mavec to your dependencies in Cargo.toml:
[dependencies]
mavec = "0.1.2"
use mavec::core::to_vec;
use serde_json::json;
fn main() {
let value = json!({
"Jeff": true,
"Rose": "Mary",
"Miguel": 17,
});
assert_eq!(
to_vec(value).unwrap(),
Vec::from([
"Jeff".to_string(),
"true".to_string(),
"Rose".to_string(),
"Mary".to_string(),
"Miguel".to_string(),
"17".to_string()
])
);
let value = Value::Array(vec![
json!(1),
Value::Bool(true),
Value::String(String::from("Mavec")),
Value::Bool(false),
]);
assert_eq!(
to_vec(value).unwrap(),
Vec::from([
"1".to_string(),
"true".to_string(),
"Mavec".to_string(),
"false".to_string(),
])
);
}
to_vec() now works not only for Value::Object but also with a Value::Array Value.Contributions are welcome! If you have ideas for new features or optimizations, feel free to open an issue or submit a pull request.