diff --git a/Cargo.toml b/Cargo.toml index 802c982..62f2389 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,4 +81,4 @@ luajit = ["lua", "mlua-codemp-patch/luajit"] [package.metadata.docs.rs] # enabled features when building on docs.rs -features = ["lua54", "java", "js", "python"] +features = ["serialize"] diff --git a/src/ffi/java/mod.rs b/src/ffi/java/mod.rs index 7c0ca05..c75f7f5 100644 --- a/src/ffi/java/mod.rs +++ b/src/ffi/java/mod.rs @@ -1,11 +1,3 @@ -//! ### java -//! Since for java it is necessary to deal with the JNI and no complete FFI library is available, -//! java glue directly writes JNI functions leveraging [jni] rust bindings. -//! -//! To have a runnable `jar`, some extra Java code must be compiled (available under `dist/java`) -//! and bundled together with the shared object. Such extra wrapper provides classes and methods -//! loading the native extension and invoking the underlying native functions. - pub mod client; pub mod workspace; pub mod cursor; diff --git a/src/ffi/js/mod.rs b/src/ffi/js/mod.rs index bdad225..e1b6ddf 100644 --- a/src/ffi/js/mod.rs +++ b/src/ffi/js/mod.rs @@ -1,7 +1,3 @@ -//! ### javascript -//! Using [napi] it's possible to map perfectly the entirety of `codemp` API. -//! Async operations run on a dedicated [tokio] runtime and the result is sent back to main thread - pub mod client; pub mod workspace; pub mod cursor; diff --git a/src/ffi/lua.rs b/src/ffi/lua.rs index 87ffe41..756e45a 100644 --- a/src/ffi/lua.rs +++ b/src/ffi/lua.rs @@ -1,16 +1,3 @@ -//! ### Lua -//! Using [mlua] it's possible to map almost perfectly the entirety of `codemp` API. -//! Notable outliers are functions that receive `codemp` objects: these instead receive arguments -//! to build the object instead (such as [`crate::api::Controller::send`]) -//! -//! Note that async operations are carried out on a [tokio] current_thread runtime, so it is -//! necessary to drive it. A separate driver thread can be spawned with `spawn_runtime_driver` -//! function. -//! -//! To work with callbacks, the main Lua thread must periodically stop and poll for callbacks via -//! `poll_callback`, otherwise those will never run. This is necessary to allow safe concurrent -//! access to the global Lua state, so minimize callback execution time as much as possible. - use std::io::Write; use std::sync::Mutex; diff --git a/src/ffi/mod.rs b/src/ffi/mod.rs index 241bdee..ea93cd2 100644 --- a/src/ffi/mod.rs +++ b/src/ffi/mod.rs @@ -1,9 +1,38 @@ -//! ### FFI +//! # FFI //! The glue code for FFI (Foreign Function Interface) in various languages, each gated behind //! a feature flag. //! //! For all except Java, the resulting shared object is ready to use, but external packages are //! available to simplify dependency management and provide type hints in editor. +//! +//! ## Lua +//! Using [mlua](https://docs.rs/mlua) it's possible to map almost perfectly the entirety of `codemp` API. +//! Notable outliers are functions that receive `codemp` objects: these instead receive arguments +//! to build the object instead (such as [`crate::api::Controller::send`]) +//! +//! Note that async operations are carried out on a [tokio] current_thread runtime, so it is +//! necessary to drive it. A separate driver thread can be spawned with `spawn_runtime_driver` +//! function. +//! +//! To work with callbacks, the main Lua thread must periodically stop and poll for callbacks via +//! `poll_callback`, otherwise those will never run. This is necessary to allow safe concurrent +//! access to the global Lua state, so minimize callback execution time as much as possible. +//! +//! ## Python +//! Using [pyo3](https://docs.rs/pyo3) it's possible to map perfectly the entirety of `codemp` API. +//! Async operations run on a dedicated [tokio] runtime +//! +//! ## JavaScript +//! Using [napi](https://docs.rs/napi) it's possible to map perfectly the entirety of `codemp` API. +//! Async operations run on a dedicated [tokio] runtime and the result is sent back to main thread +//! +//! ## Java +//! Since for java it is necessary to deal with the JNI and no complete FFI library is available, +//! java glue directly writes JNI functions leveraging [jni](https://docs.rs/jni) rust bindings. +//! +//! To have a runnable `jar`, some extra Java code must be compiled (available under `dist/java`) +//! and bundled together with the shared object. Such extra wrapper provides classes and methods +//! loading the native extension and invoking the underlying native functions. /// java bindings, built with [jni] #[cfg(feature = "java")] diff --git a/src/ffi/python/mod.rs b/src/ffi/python/mod.rs index b545afd..54ed174 100644 --- a/src/ffi/python/mod.rs +++ b/src/ffi/python/mod.rs @@ -1,7 +1,3 @@ -//! ### python -//! Using [pyo3] it's possible to map perfectly the entirety of `codemp` API. -//! Async operations run on a dedicated [tokio] runtime - pub mod client; pub mod controllers; pub mod workspace;