Skip to content

Commit

Permalink
remove protoc library dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
kvc0 committed Nov 27, 2024
1 parent 66c45d8 commit 8469bd8
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 3 deletions.
6 changes: 6 additions & 0 deletions rmemstore-messages/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#[allow(clippy::unwrap_used)]
fn main() {
if std::env::var("REFRESH_MESSAGES").is_err() {
eprintln!("skipping message generation - specify REFRESH_MESSAGES=1 to force a refresh");
return;
}

let proto_dir = "proto";

let mut config = prost_build::Config::new();
Expand All @@ -9,6 +14,7 @@ fn main() {
".rmemstore.Put.key",
".rmemstore.Get.key",
]);
config.out_dir("./src");

if std::env::var("CI").is_ok() {
eprintln!("skipping python output");
Expand Down
4 changes: 1 addition & 3 deletions rmemstore-messages/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#[rustfmt::skip]
#[allow(clippy::all)]
mod rmemstore {
include!(concat!(env!("OUT_DIR"), "/rmemstore.rs"));
}
mod rmemstore;

pub mod protosocket_adapter;

Expand Down
87 changes: 87 additions & 0 deletions rmemstore-messages/src/rmemstore.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// This file is @generated by prost-build.
/// An action to be taken
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Rpc {
#[prost(uint64, tag = "1")]
pub id: u64,
#[prost(uint32, tag = "2")]
pub code: u32,
#[prost(oneof = "rpc::Command", tags = "3, 4")]
pub command: ::core::option::Option<rpc::Command>,
}
/// Nested message and enum types in `Rpc`.
pub mod rpc {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Command {
/// Response kind: ok
#[prost(message, tag = "3")]
Put(super::Put),
/// Response kind: Value
#[prost(message, tag = "4")]
Get(super::Get),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Response {
#[prost(uint64, tag = "1")]
pub id: u64,
#[prost(uint32, tag = "2")]
pub code: u32,
#[prost(oneof = "response::Kind", tags = "3, 4")]
pub kind: ::core::option::Option<response::Kind>,
}
/// Nested message and enum types in `Response`.
pub mod response {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Kind {
#[prost(bool, tag = "3")]
Ok(bool),
#[prost(message, tag = "4")]
Value(super::Value),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Value {
#[prost(oneof = "value::Kind", tags = "1, 2, 3")]
pub kind: ::core::option::Option<value::Kind>,
}
/// Nested message and enum types in `Value`.
pub mod value {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Kind {
#[prost(bytes, tag = "1")]
Blob(::prost::bytes::Bytes),
#[prost(string, tag = "2")]
String(::prost::alloc::string::String),
#[prost(message, tag = "3")]
Map(super::Map),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Map {
#[prost(map = "string, message", tag = "1")]
pub map: ::std::collections::HashMap<::prost::alloc::string::String, Value>,
}
/// Returns response.kind.ok
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Put {
#[prost(bytes = "bytes", tag = "1")]
pub key: ::prost::bytes::Bytes,
#[prost(message, optional, tag = "2")]
pub value: ::core::option::Option<Value>,
}
/// Returns response.kind.value, or no value upon a miss.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Get {
#[prost(bytes = "bytes", tag = "1")]
pub key: ::prost::bytes::Bytes,
}

0 comments on commit 8469bd8

Please sign in to comment.