mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 15:34:53 +01:00
build: initial commit with tonic stubs
This commit is contained in:
commit
65300edf90
9 changed files with 80 additions and 0 deletions
10
.editorconfig
Normal file
10
.editorconfig
Normal 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
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
1
.rustfmt.toml
Normal file
1
.rustfmt.toml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
hard_tabs = true
|
20
Cargo.toml
Normal file
20
Cargo.toml
Normal 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
4
build.rs
Normal 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
15
proto/core.proto
Normal 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
13
src/client.rs
Normal 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
3
src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
13
src/server.rs
Normal file
13
src/server.rs
Normal 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() {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue