#logic #reactive #control #low-code #events

nightly logic-mesh

Control logic engine using event based and reactive blocks written in Rust

11 releases

0.1.10 Mar 20, 2024
0.1.9 Feb 1, 2024
0.1.8 Jan 10, 2024
0.1.5 Dec 23, 2023
0.1.1 Jun 28, 2023

#348 in WebAssembly

Download history 13/week @ 2024-09-18 21/week @ 2024-09-25

453 downloads per month

BSD-3-Clause

300KB
7.5K SLoC

GitHub CI License crates.io npm

Logic Mesh

A logic engine, written in Rust, that is fully async, dynamic, and reactive.

Example program

Possible applications

Logic Mesh started as a hardware control engine, but the scope expanded to anything that requires a reactive and dynamic evaluation engine. It is designed to be used in a variety of applications, from hardware controls, games to web servers. It is designed to be fast, efficient, and easy to use.

The included WASM support allows it to be used in web applications, with the option to use the same codebase for both the frontend and backend.

Features

  • Fully async and reactive
  • WASM support
  • Uses Tokio for async runtime
  • The API is simple enough to be used in a variety of applications
  • A low code editor is included as an example of how Logic Mesh can be used
  • A growing library of built-in blocks
  • Extensible with custom blocks, either in Rust or JavaScript when running in a WASM environment

UI Editor

There is a sample low code editor that is built on top of Logic Mesh, which can be found here. It serves as an example of how Logic Mesh can be used, and as a simple way to experiment with the Logic Mesh engine.

NPM Package

The engine is also available as an NPM package, which can be found here. The NPM package is a thin wrapper around the WASM package, and it can be used in a Node.js environment.

Examples

The following examples are written in Rust.

// Init a Add block
let mut add1 = Add::new();
// Init a SineWave block
let mut sine1 = SineWave::new();

// Se the amplitude and frequency of the sine wave
sine1.amplitude.val = Some(3.into());
sine1.freq.val = Some(200.into());
// Connect the output of the sine wave to the first input of the add block
connect_output(&mut sine1.out, add1.inputs_mut()[0]).expect("Connected");

// Init another SineWave block
let mut sine2 = SineWave::new();
sine2.amplitude.val = Some(7.into());
sine2.freq.val = Some(400.into());

// Connect the output of the sine wave to the second input of the add block
sine2
	.connect_output("out", add1.inputs_mut()[1])
	.expect("Connected");

// Init a single threaded engine
let mut engine = SingleThreadedEngine::new();

// Schedule the blocks to be run
engine.schedule(add1);
engine.schedule(sine1);
engine.schedule(sine2);

// Run the engine
engine.run().await;

Dependencies

~7–17MB
~226K SLoC