Giter VIP home page Giter VIP logo

rust-protobuf-example's Introduction

rust-protobuf-example

Example rust protobuf project

Motivation

Simple and obvious examples for using rust-protobuf module were lacking, so this was created.

Dependencies

protoc (Protobuf Compiler)

Installation instructions

Installing Protoc on Ubuntu (and similar)

sudo apt install protobuf-compiler

Look here

Key files to read are:

  • src/protos/example.proto
  • src/main.rs
  • build.rs

Using

Standard rust package:

$ cargo build
$ cargo run

Contributions

Contributions are welcome. File an issue or PR.

rust-protobuf-example's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rust-protobuf-example's Issues

Curious about `set_name`, `set_age`, etc.

Greetings!

I'm a bit new to Rust, so bare with me if this is a bit of a noobish question. Taking a look at main.rs, I noticed calls to out_msg.set_name and out_msg.set_age and I'm not entirely sure of where they come from:

out_msg.set_name("John Smith".to_string());
out_msg.set_age(25);

Are these automatically generated? I'm not seeing definitions for them anywhere.

Thanks!

Build Error from following build instructions in README

cargo build

  Compiling rust-protobuf-example v1.0.1 (/home/kevlar/rust-protobuf-example)
error: failed to run custom build command for `rust-protobuf-example v1.0.1 (/home/kevlar/rust-protobuf-example)`

Caused by:
  process didn't exit successfully: `/home/kevlar/rust-protobuf-example/target/debug/build/rust-protobuf-example-c10fd022b491d154/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'protoc binary not found: cannot find binary path', /home/kevlar/.cargo/registry/src/github.com-1ecc6299db9ec823/protoc-2.27.1/src/lib.rs:209:17
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
     1: core::panicking::panic_fmt
               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
     2: protoc::Protoc::from_env_path
               at /home/kevlar/.cargo/registry/src/github.com-1ecc6299db9ec823/protoc-2.27.1/src/lib.rs:209:17
     3: protoc_rust::Codegen::run
               at /home/kevlar/.cargo/registry/src/github.com-1ecc6299db9ec823/protoc-rust-2.27.1/src/lib.rs:173:21
     4: protoc_rust::run
               at /home/kevlar/.cargo/registry/src/github.com-1ecc6299db9ec823/protoc-rust-2.27.1/src/lib.rs:237:5
     5: build_script_build::main
               at ./build.rs:6:2
     6: core::ops::function::FnOnce::call_once
               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:227:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Documentation for rust-protobuf [NotAnIssue]

Hi @jgarzik , thank you for building this example, it's laterally the only "end-to-end" example of the rust-protobuf I could find.
On the other hand, it has been "hard" to spot...

The maintainer of rust-protobuf is seeking for help, among others for examples and documentation.

Why don't you propose your work here on it's repo?
I'm sure people will appreciate your contribution there ๐Ÿ‘

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.