panproto-parse 0.48.6

Tree-sitter full-AST parsers and emitters for panproto language protocols
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Parse a real OpenTelemetry `trace.proto` into a full-AST schema.

use std::path::Path;

use panproto_parse::ParserRegistry;

const TRACE_PROTO: &[u8] = include_bytes!("../../../fixtures/protobuf/trace.proto");

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let registry = ParserRegistry::new();
    let schema = registry.parse_file(Path::new("trace.proto"), TRACE_PROTO)?;
    println!(
        "parsed trace.proto: {} vertices, {} edges",
        schema.vertices.len(),
        schema.edges.len()
    );
    Ok(())
}