Crates.io | bellande_parser |
lib.rs | bellande_parser |
version | 0.0.1 |
source | src |
created_at | 2024-09-13 00:00:11.119583 |
updated_at | 2024-09-13 00:00:11.119583 |
description | Bellande File Format |
homepage | |
repository | |
max_upload_size | |
id | 1373220 |
size | 9,835 |
use std::collections::HashMap;
use bellande::{BellandeFormat, BellandeValue};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a BellandeFormat instance
let bellande_formatter = BellandeFormat;
// Parse a Bellande file
let parsed_data = bellande_formatter.parse_bellande("path/to/your/file.bellande")?;
println!("{:#?}", parsed_data);
// Create data to write
let mut data_to_write = HashMap::new();
data_to_write.insert("key".to_string(), BellandeValue::String("value".to_string()));
data_to_write.insert("list".to_string(), BellandeValue::List(vec![
BellandeValue::Integer(1),
BellandeValue::Integer(2),
BellandeValue::Integer(3),
]));
let bellande_value = BellandeValue::Map(data_to_write);
// Write data to a Bellande file
bellande_formatter.write_bellande(&bellande_value, "path/to/output/file.bellande")?;
Ok(())
}
cargo add bellande_format
Name: bellande_format
Version: 0.1.0
Summary: File type Formats
Home-page: github.com/RonaldsonBellande/bellande_format
Author: Ronaldson Bellande
Author-email: ronaldsonbellande@gmail.com
License: GNU General Public License v3.0
This Algorithm or Models is distributed under the Creative Commons Attribution-ShareAlike 4.0 International License, see LICENSE and NOTICE for more information.