Created
June 25, 2022 09:08
-
-
Save codedjinn/0bcd7dd133dcbfd602dee6139a9d3280 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{path::Path, fmt::DebugSet}; | |
| fn main() { | |
| let mut parser = protobuf_parse::Parser::new(); | |
| parser.pure(); | |
| let file = Path::new("D:/protos/hello.proto"); | |
| parser.include("D:/protos"); | |
| parser.input(file); | |
| let result = parser.parse_and_typecheck(); | |
| if result.is_err() { | |
| println!("DAMN! {:?}", result.as_ref().err()); | |
| } | |
| let parsed = result.ok().unwrap(); | |
| for descriptor in parsed.file_descriptors { | |
| println!("name {}", descriptor.name()); | |
| for service in descriptor.service { | |
| println!("\tservice {}", service.name()); | |
| for method in service.method { | |
| println!("\t\tmethod {}", method.name()); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment