Gura Rust parser
![Rust](https://github.com/gura-conf/gura-rs-parser/actions/workflows/rust.yml/badge.svg?branch=main)
This repository contains the implementation of a Gura (compliant with version 1.0.0) format parser for Rust lang.
Documentation -
Cargo
Installation
Add the dependency to your Cargo.toml
:
[dependencies]
gura = "0.3.4"
Usage
use gura::{dump, parse, GuraType};
fn main() {
let gura_string = r##"
# This is a Gura document.
title: "Gura Example"
an_object:
username: "Stephen"
pass: "Hawking"
# Line breaks are OK when inside arrays
hosts: [
"alpha",
"omega"
]"##;
let parsed = parse(&gura_string).unwrap();
println!("Title -> {}", parsed["title"]);
println!("\nHosts:");
if let GuraType::Array(hosts) = &parsed["hosts"] {
for host in hosts.iter() {
println!("Host -> {}", *host);
}
}
let string_again = dump(&parsed);
println!("\n+++++ Dump result +++++");
println!("{}", string_again);
}
Contributing
All kind of contribution is welcome! If you want to contribute just:
- Fork this repository.
- Create a new branch and introduce there your new changes.
- Make a Pull Request!
Or you can join to our community in Discord!
Tests
To run all the tests: cargo test
Licence
This repository is distributed under the terms of the MIT license.