2 unstable releases

new 0.96.0 Jan 10, 2025
0.95.0 Jan 8, 2025

#684 in Hardware support

Download history 261/week @ 2025-01-07

261 downloads per month
Used in rusp

BSD-3-Clause

510KB
11K SLoC

Continuous integration

rhai-rusp

rhai-rusp is a new approach to address your USP protocol needs by providing Rhai bindings for the rusp-lib crate, thus providing scripting capabilities to USP in Rhai for either standalone runners or Rust applications which can embed the Rhai interpreter together with the rhai-rusp bindings.

How to embed rhai-rusp?

rhai-rusp can be used as a library in your own Rust applications to embed a Rhai interpreter . To use rhai-rusp as a library, you simply need to add the rhai-rusp crate to your Cargo.toml as dependency:

[dependencies]
rhai-rusp = "0.96.0"

The usual steps to embed a Rhai interpreter with rusp support are:

  1. Initialise a Rhai engine via rhai::Engine::new()
  2. Add the rusp bindings into the namespace per engine.register_static_module("rusp", RuspPackage::new().as_shared_module())
  3. Compile the Rhai code into an AST via engine.compile(contents)
  4. Execute the Rhai AST via engine.run_ast(ast)
  5. Handle errors, err... profit!

There's also the rusp-run binary as part of the rusp crate which you can install via:

# cargo install rusp

What else?

You may use this crate however you like under the BSD 3-Clause Licence.

Feel free to spread the word or drop us a note if you like it. Collaboration on this crate is highly welcome as are pull requests in our GitHub repo.

Contact us

If you are in need of software for USP management software (agent, controller or testing) or expertise please get in touch with us. We're also happy to solve all other device management and monitoring needs!

Licence

BSD 3-Clause Licence.

Dependencies

~6.5MB
~121K SLoC