escouade-plugin-protocol 0.1.0

The JSON-RPC protocol of Escouade's plugins: its constants, its messages and the loop of a plugin, in process or as a WASM module
Documentation
  • Coverage
  • 46.1%
    331 out of 718 items documented1 out of 108 items with examples
  • Size
  • Source code size: 106.0 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 9.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • guillaume-gagnaire/escouade
    38 9 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • guillaume-gagnaire

escouade-plugin-protocol

The protocol Escouade speaks to its plugins: JSON-RPC 2.0, one message a line. This crate holds what both sides share: the version, the methods, the messages of the handshake and of the extension points.

A plugin that answers at once, a state machine, needs nothing else, and the same source compiles in process and for wasm32-wasip1:

use escouade_plugin_protocol::{turn, Refusal};
use serde_json::{json, Value};

pub fn run() -> i32 {
    turn::run("example", json!({}), |method, _params: Value| {
        Err(Refusal::not_found(method))
    })
}

escouade_plugin_protocol::module!(run);

turn also gives what std cannot give a module: turn::instance_id() in place of std::process::id(), and turn::read_file() in place of std::fs.

A plugin whose calls wait on the network will rather take escouade-plugin-kit.

The reference of the plugins: https://escouade.dev/en/docs/plugins/api. The code is in Escouade's repository. This crate is under the MIT licence; the app is under GPL-3.0-or-later.