Crates.io | mabel-eno |
lib.rs | mabel-eno |
version | 0.4.4 |
source | src |
created_at | 2024-05-22 18:12:11.001652 |
updated_at | 2024-05-25 03:30:45.293166 |
description | Eno parsing library for Rust |
homepage | |
repository | https://codeberg.org/fawn/mabel |
max_upload_size | |
id | 1248264 |
size | 165,567 |
A feature-complete, pure rust parser for Eno.
Note on packaging: Not yet released as a crate, but can be pulled in via git regardless.
Note on stability: The parsing itself is quite stable, the API is currently still in flux though.
Add the library to the dependencies in your Cargo.toml
:
[dependencies]
...
enolib = { git = "https://codeberg.org/simonrepp/enolib-rs" }
Some example code to get you started:
use enolib;
fn main() {
let result = my_parse("greeting: hello");
dbg!(result); // Ok("hello")
}
fn my_parse(input: &str) -> Result<String, enolib::Error> {
enolib::parse(input)?
.field("greeting")?
.required_value()
}
Until there is more documentation, I recommend you clone the repository and in its root run this to generate and access the documentation in your browser:
cargo doc --no-deps --open
From there go to the documentation for parse
and traverse the documentation
for what it returns downwards, until you are at the bottom of the tree, where
you have everything you need to parse any eno document!