13 releases (4 breaking)

0.6.0 Jan 14, 2024
0.5.4 Jan 6, 2024
0.4.3 Jan 1, 2024
0.4.2 Dec 31, 2023
0.2.1 Dec 29, 2023

#32 in #plugin-system

Download history 37/week @ 2024-01-05 9/week @ 2024-01-12 39/week @ 2024-02-23 14/week @ 2024-03-01 1/week @ 2024-03-08 1/week @ 2024-03-15 66/week @ 2024-03-29 13/week @ 2024-04-05

79 downloads per month
Used in io-plugin

GPL-3.0-only

32KB
764 lines

IO-Plugin

IO-Plugin is a rust package which allows easily creating a plugin-system based on the following model:

  1. The host spawns instances of its' plugins (by runnning their executables)
  2. The host sends serialised messages on the plugin process' stdin
  3. The host receives serialised responses on the plugin process' stdout

Theoretically, it is also possible to create plugins in other languages, though their interfaces will have to be determined manually. The messages are currently serialised using serde-cbor (this is subject to change at my discretion - though I expect to stick to serde-supported formats).

A usage example is available under ./io-plugins-test

Checklist:

  • Determine structure for translating a provided enum to the various relevant data structures.
  • Write a macro that converts said enum to the data structure
  • Attribute-forwarding (besides just documentation)
  • Create sensible default implementations (except for the plugin-trait methods)
  • Support generics (types only - no lifetimes)
  • Allow providing custom default implementations (for example - to output the interface version a plugin was compiled against)
  • Increase clarity of error messages (there are probably some invalid usages which result in unclear errors)

Dependencies

~3–4.5MB
~86K SLoC