build: initial commit with tonic stubs

This commit is contained in:
əlemi 2022-07-10 19:01:56 +02:00
commit 65300edf90
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E
9 changed files with 80 additions and 0 deletions

10
.editorconfig Normal file
View file

@ -0,0 +1,10 @@
# Default to Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 4
[*.rs]
indent_size = 2

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

1
.rustfmt.toml Normal file
View file

@ -0,0 +1 @@
hard_tabs = true

20
Cargo.toml Normal file
View file

@ -0,0 +1,20 @@
[package]
name = "codemp"
version = "0.1.0"
edition = "2021"
[[bin]] # Bin to run the CodeMP gRPC server
name = "codemp-server"
path = "src/server.rs"
[[bin]] # Bin to run the CodeMP gRPC client
name = "codemp-client"
path = "src/client.rs"
[dependencies]
tonic = "0.7"
prost = "0.10"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
[build-dependencies]
tonic-build = "0.7"

4
build.rs Normal file
View file

@ -0,0 +1,4 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::compile_protos("proto/core.proto")?;
Ok(())
}

15
proto/core.proto Normal file
View file

@ -0,0 +1,15 @@
syntax = "proto3";
package core;
service Session {
rpc Create (SessionRequest) returns (SessionResponse);
}
message SessionRequest {
int32 sessionId = 1;
}
message SessionResponse {
int32 sessionId = 1;
}

13
src/client.rs Normal file
View file

@ -0,0 +1,13 @@
use tonic::{transport::Server, Request, Response, Status};
pub mod proto_core {
tonic::include_proto!("core");
}
use proto_core::session_server::{Session, SessionServer};
use proto_core::{SessionRequest, SessionResponse};
pub fn main() {
}

3
src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

13
src/server.rs Normal file
View file

@ -0,0 +1,13 @@
use tonic::{transport::Server, Request, Response, Status};
pub mod proto_core {
tonic::include_proto!("core");
}
use proto_core::session_server::{Session, SessionServer};
use proto_core::{SessionRequest, SessionResponse};
pub fn main() {
}