From 47127bbb41d803d7f2d12371dd09e2643789b630 Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 9 Feb 2024 00:39:07 +0100 Subject: [PATCH] chore: back from transport to proto --- Cargo.toml | 12 ++++++------ build.rs | 2 +- src/api/change.rs | 2 +- src/lib.rs | 12 +++++------- src/prelude.rs | 2 +- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 48c95c2..10cbf57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,9 +31,9 @@ postcard = { version = "1.0.8", optional = true } tonic-build = "0.9" [features] -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"] +default = [] +api = ["woot", "dep:tokio", "dep:async-trait"] +woot = ["dep:codemp-woot", "dep:similar"] +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"] diff --git a/build.rs b/build.rs index 504944e..d4f38c1 100644 --- a/build.rs +++ b/build.rs @@ -2,7 +2,7 @@ fn main() -> Result<(), Box> { 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", diff --git a/src/api/change.rs b/src/api/change.rs index 9fbf0a5..79b6982 100644 --- a/src/api/change.rs +++ b/src/api/change.rs @@ -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; diff --git a/src/lib.rs b/src/lib.rs index 5b602ac..68ad511 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,12 +21,10 @@ //! immediately but instead deferred until compatible. //! //! ## features -//! * `woot` : include the underlying CRDT library and re-exports it (default enabled) -//! * `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] +//! * `woot` : include the underlying CRDT library and re-exports it (default enabled) +//! * `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) //! //! ## 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 { diff --git a/src/prelude.rs b/src/prelude.rs index 077a94b..c01864c 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -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,