2 releases

0.4.4 May 25, 2024
0.4.3 May 22, 2024

#4 in #released


Used in mabel

Apache-2.0

160KB
4.5K SLoC

enolib

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.

Getting started

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!

No runtime deps