chore: back from transport to proto

This commit is contained in:
əlemi 2024-02-09 00:39:07 +01:00
parent 45c1106d98
commit 47127bbb41
5 changed files with 14 additions and 16 deletions

View file

@ -34,6 +34,6 @@ tonic-build = "0.9"
default = []
api = ["woot", "dep:tokio", "dep:async-trait"]
woot = ["dep:codemp-woot", "dep:similar"]
transport = ["dep:prost", "dep:tonic", "dep:uuid"]
client = ["transport", "api", "dep:tokio", "dep:tokio-stream", "dep:uuid", "dep:md5", "dep:serde_json", "dep:dashmap", "dep:postcard"]
server = ["transport", "woot"]
proto = ["dep:prost", "dep:tonic", "dep:uuid"]
client = ["proto", "api", "dep:tokio", "dep:tokio-stream", "dep:uuid", "dep:md5", "dep:serde_json", "dep:dashmap", "dep:postcard"]
server = ["proto", "woot"]

View file

@ -2,7 +2,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
// .build_client(cfg!(feature = "client"))
// .build_server(cfg!(feature = "server")) // FIXME if false, build fails????
// .build_transport(cfg!(feature = "transport"))
// .build_transport(cfg!(feature = "proto"))
.compile(
&[
"proto/common.proto",

View file

@ -112,7 +112,7 @@ impl TextChange {
/// convert from byte index to row and column
/// txt must be the whole content of the buffer, in order to count lines
#[cfg(feature = "transport")]
#[cfg(feature = "proto")]
pub fn index_to_rowcol(txt: &str, index: usize) -> crate::proto::cursor::RowCol {
// FIXME might panic, use .get()
let row = txt[..index].matches('\n').count() as i32;

View file

@ -25,8 +25,6 @@
//! * `api` : include traits for core interfaces under [api] (default enabled)
//! * `proto` : include GRCP protocol definitions under [proto] (default enabled)
//! * `client` : include the local [client] implementation (default enabled)
//! * `global`: provide a lazy_static global INSTANCE in [instance::global]
//! * `sync` : wraps the [instance::a_sync::Instance] holder into a sync variant: [instance::sync::Instance]
//!
//! ## examples
//! while the [client::Client] itself is the core structure implementing all methods, plugins will mostly
@ -160,7 +158,7 @@ pub mod prelude;
pub use woot;
/// protocol types and services auto-generated by grpc
#[cfg(feature = "transport")]
#[cfg(feature = "proto")]
#[allow(non_snake_case)]
pub mod proto {
pub mod common {

View file

@ -26,7 +26,7 @@ pub use crate::{
buffer::Controller as CodempBufferController,
};
#[cfg(feature = "transport")]
#[cfg(feature = "proto")]
pub use crate::{
proto::cursor::CursorPosition as CodempCursorPosition,
proto::cursor::CursorEvent as CodempCursorEvent,