adapter-libloading

Crates.ioadapter-libloading
lib.rsadapter-libloading
version0.2.0
sourcesrc
created_at2024-07-17 22:04:07.966854
updated_at2024-07-18 22:56:22.88033
descriptionAn Adapter for adapting the libloading library to the Adapter API.
homepagehttps://github.com/sjcobb2022/adapter
repositoryhttps://github.com/sjcobb2022/adapter
max_upload_size
id1306641
size4,175
Samuel Cobb (sjcobb2022)

documentation

README

Adapter

[!WARNING]
This library is in no way production ready.

Adapter is a library meant for providing a standard interface for which one can communicate with a variety of interfaces or plugins. It was created from a desire to be able to configure programs with a variety of different languages.

To see the thought process behind this, see RAMBLINGS.md.

The key concept of this library is the Adapter trait. It hinges on the idea that communicating with a foreign interface should be as simple as a function that has an input and an output. We use an identifier to determine the "endpoint" that we want to access.

pub trait Adapter<'a, Input, Output, Identifier, Error> {
    fn call(&'a mut self, identifier: Identifier, input: Input) -> Result<Output, Error>;
}

An adapter is generic over the input, output, identifier and error that is uses. It takes in an identifier and an input, and returns a result with the output or an error. By being generic, we can require stricter traits be applied to our inputs and outputs.

Repository Structure

  • adapter: The adapter trait implementation.
  • adapter-extism: An adapter for the extism library.
  • adapter-libloading: An adapter for dynamic libraries.
  • adapter-mlua: An adapter for including lua via mlua.
Commit count: 0

cargo fmt