Skip to content

Commit

Permalink
Tweak doc formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhickman committed Jun 9, 2023
1 parent b89ea08 commit 83db83e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

An implementation of the protobuf compiler in rust, intended for use as a library with crates such as [`prost-build`](https://crates.io/crates/prost-build) to avoid needing to build `protoc`.

## Usage
## Examples

Compiling a single source file:

Expand All @@ -25,17 +25,13 @@ assert_eq!(protox::compile(["root.proto"], ["."]).unwrap(), FileDescriptorSet {
});
```

## prost-build

Usage with `prost-build`:

```rust
let file_descriptors = protox::compile(["root.proto"], ["."]).unwrap();
prost_build::compile_fds(file_descriptors).unwrap();
```

## tonic-build

Usage with `tonic-build`:

```rust
Expand All @@ -52,7 +48,7 @@ tonic_build::Config::new()
.unwrap();
```

## Error messages
### Error messages

This crate uses [`miette`](https://crates.io/crates/miette) to add additional details to errors. For nice error messages, add `miette` as a dependency with the `fancy` feature enabled and return a [`miette::Result`](https://docs.rs/miette/latest/miette/type.Result.html) from your build script.

Expand All @@ -69,7 +65,7 @@ Example error message:
```
Error:
× name 'Bar' is not defined
╭─[test.proto:3:1]
╭─[root.proto:3:1]
3 │ message Foo {
4 │ Bar bar = 1;
· ─┬─
Expand Down

0 comments on commit 83db83e

Please sign in to comment.