Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(prost-build): Use cargo add in example #1149

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions prost-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,18 @@
//!
//! ## Example
//!
//! Let's create a small crate, `snazzy`, that defines a collection of
//! Let's create a small library crate, `snazzy`, that defines a collection of
//! snazzy new items in a protobuf file.
//!
//! ```bash
//! $ cargo new snazzy && cd snazzy
//! $ cargo new --lib snazzy && cd snazzy
//! ```
//!
//! First, add `prost-build`, `prost` and its public dependencies to `Cargo.toml`
//! (see [crates.io](https://crates.io/crates/prost) for the current versions):
//! First, add `prost-build` and `prost` as dependencies to `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! bytes = <bytes-version>
//! prost = <prost-version>
//!
//! [build-dependencies]
//! prost-build = { version = <prost-version> }
//! ```bash
//! $ cargo add --build prost-build
//! $ cargo add prost
//! ```
//!
//! Next, add `src/items.proto` to the project:
Expand All @@ -36,13 +31,16 @@
//!
//! // A snazzy new shirt!
//! message Shirt {
//! // Label sizes
//! enum Size {
//! SMALL = 0;
//! MEDIUM = 1;
//! LARGE = 2;
//! }
//!
//! // The base color
//! string color = 1;
//! // The size as stated on the label
//! Size size = 2;
//! }
//! ```
Expand Down Expand Up @@ -71,6 +69,7 @@
//!
//! use snazzy::items;
//!
//! /// Returns a large shirt of the specified color
//! pub fn create_large_shirt(color: String) -> items::Shirt {
//! let mut shirt = items::Shirt::default();
//! shirt.color = color;
Expand Down