mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
chore: back from transport to proto
This commit is contained in:
parent
45c1106d98
commit
47127bbb41
5 changed files with 14 additions and 16 deletions
12
Cargo.toml
12
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"]
|
||||
|
|
2
build.rs
2
build.rs
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
12
src/lib.rs
12
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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue