The pieces / weirdnet-plugin

weirdnet-plugin

The plugin SDK: the stable C ABI (v2), host API, frames and result views.

GitHub crates.io docs.rs weirdnet-plugin = "0.1"

What it is

The SDK for Weirdnet code space plugins. A plugin is a cdylib exporting weirdnet_plugin_abi, weirdnet_plugin_info and weirdnet_plugin_run; the crate has no dependencies, so plugins build offline. Hosts load plugins with weirdnet-code-spaces.

This in-process ABI is for trusted first-party plugins only; untrusted extensions run out of process in a sandbox.

What is in it

  • The stable C ABI, version 2 (version 1’s layout; only symbol names and the version differ).
  • The safe Host API over the host’s JSON methods, frames of loaded records and series helpers.
  • Result views (table, chart, text, tiles), the ingest-connector methods, and the plugin! macro.

Example

use weirdnet_plugin::prelude::*;
          
          pub fn run(host: &Host) -> Result<View> {
              let bars = host.input()?;
              let close = bars.f64("close")?;
              Ok(View::chart("close").x("timestamp", bars.f64("timestamp")?, true).line("close", close))
          }
          weirdnet_plugin::plugin!(run);

Where it fits

  • Used by weirdnet-code-spaces.
  • Extracted from Muninn.
  • License: BSD-3-Clause.