chore: move ffi infos in root mod

because i actually dont want docs.rs to build with ffi flags anymore:
docs get "littered" with napi auto methods and pyo3 stuff, which is
annoying and needless noise when reading the doc. I would much rather
only have relevant stuff, to not make doc consumers hop around guessing
what is relevant and what not
This commit is contained in:
əlemi 2024-09-13 12:02:48 +02:00
parent d633884dbb
commit c0b8906043
Signed by: alemi
GPG key ID: A4895B84D311642C
6 changed files with 31 additions and 31 deletions

View file

@ -81,4 +81,4 @@ luajit = ["lua", "mlua-codemp-patch/luajit"]
[package.metadata.docs.rs] # enabled features when building on docs.rs [package.metadata.docs.rs] # enabled features when building on docs.rs
features = ["lua54", "java", "js", "python"] features = ["serialize"]

View file

@ -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 client;
pub mod workspace; pub mod workspace;
pub mod cursor; pub mod cursor;

View file

@ -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 client;
pub mod workspace; pub mod workspace;
pub mod cursor; pub mod cursor;

View file

@ -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::io::Write;
use std::sync::Mutex; use std::sync::Mutex;

View file

@ -1,9 +1,38 @@
//! ### FFI //! # FFI
//! The glue code for FFI (Foreign Function Interface) in various languages, each gated behind //! The glue code for FFI (Foreign Function Interface) in various languages, each gated behind
//! a feature flag. //! a feature flag.
//! //!
//! For all except Java, the resulting shared object is ready to use, but external packages are //! 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. //! 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] /// java bindings, built with [jni]
#[cfg(feature = "java")] #[cfg(feature = "java")]

View file

@ -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 client;
pub mod controllers; pub mod controllers;
pub mod workspace; pub mod workspace;