Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/context export #37

Merged
merged 8 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 90 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To use plugy in your Rust project, follow these steps:

1. Write your plugin trait:

```rust
```rust,ignore
#[plugy::plugin]
trait Greeter {
fn greet(&self) -> String;
Expand All @@ -29,7 +29,7 @@ trait Greeter {

2. Write your first plugin implementation

```rust
```rust,ignore
#[derive(Debug, Deserialize)]
struct FooPlugin;

Expand All @@ -43,13 +43,13 @@ impl Greeter for FooPlugin {

Compile it!

```
```bash,ignore
cargo build --target wasm32-unknown-unknown
```

3. Import and run

```rust
```rust,ignore
#[plugin_import(file = "target/wasm32-unknown-unknown/debug/foo_plugin.wasm")]
struct FooPlugin;

Expand Down
2 changes: 1 addition & 1 deletion crates/plugy-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub trait PluginLoader {
///
/// Returns a `Pin<Box<dyn Future<Output = Result<Vec<u8>, anyhow::Error>>>>`
/// representing the asynchronous loading process.
fn load(&self) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, anyhow::Error>>>>;
fn bytes(&self) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, anyhow::Error>>>>;

/// A plugins name should be known before loading.
/// It might just be `std::any::type_name::<Self>()`
Expand Down
3 changes: 2 additions & 1 deletion crates/plugy-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ proc-macro = true
quote = "1.0"
syn = { features = ["full", "parsing"], version = "2.0" }
proc-macro2 = "1"
darling = "0.20.3"
darling = "0.20.3"
convert_case = "0.6.0"
Loading