d1vanov / thrift-parser

Rust Thrift Parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thrift Parser

Yet another thrift parser powered by nom.

Example

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);
}

About

Rust Thrift Parser


Languages

Language:Rust 99.1%Language:Thrift 0.9%