Welcome to Savefile-abi!
Full docs: https://docs.rs/savefile-abi/latest/
Savefile-abi is a crate that is primarily meant to help building binary plugins using Rust. It supports many data types from the standard library, as well as custom user types.
It supports async methods, through use of the #[async_trait] attribute macro.
= "0.18"
= "0.18"
= "0.18"
Example
Let's say we have a crate that defines this trait for adding u32s:
interface_crate
use savefile_abi_exportable;
Now, we want to implement addition in a different crate, compile it to a shared library (.dll or .so), and use it in the first crate (or some other crate):
implementation_crate
use ;
use savefile_abi_export;
// Export this implementation as the default-implementation for
// the interface 'AdderInterface', for the current library.
savefile_abi_export!;
We add the following to Cargo.toml in our implementation crate:
[]
= ["cdylib"]
Now, in our application, we add a dependency to interface_crate, but not to ImplementationCrate.
We then load the implementation dynamically at runtime:
app
use ;
use ;
Limitations
There are multiple limitations:
- Tuples are presently not supported as direct function arguments!
- There may be safety issues, Savefile-Abi is not mature yet.
See full docs: https://docs.rs/savefile-abi/latest/