Crates.io | thrift-parser |
lib.rs | thrift-parser |
version | 0.0.5 |
source | src |
created_at | 2021-07-19 07:34:47.724689 |
updated_at | 2021-07-22 16:47:08.475114 |
description | A simple thrift parser. |
homepage | |
repository | https://github.com/ihciah/thrift-parser |
max_upload_size | |
id | 424647 |
size | 70,483 |
Yet another thrift parser powered by nom.
use std::str::FromStr;
use thrift_parser::Parser;
fn main() {
let mut idl_path =
std::path::PathBuf::from_str(&std::env::var("CARGO_MANIFEST_DIR").unwrap()).unwrap();
idl_path.extend(vec!["thrift", "demo.thrift"]);
let idl = std::fs::read_to_string(idl_path).unwrap();
let (remains, document) = thrift_parser::document::Document::parse(&idl).unwrap();
println!("Parser remains: {:?}, document: {:?}", remains, document);
}