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

Created Identifier to help keep track of plugin resources. #72

Merged
merged 4 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
9 changes: 5 additions & 4 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion pumpkin-plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ edition.workspace = true

[dependencies]
extism = "1.5.0"
log.workspace = true
log.workspace = true
serde ={ version = "1.0.209", features = ["derive"] }
neeleshpoli marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 15 additions & 0 deletions pumpkin-plugin/src/api/identifer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use extism::{convert::Msgpack, host_fn, FromBytes, ToBytes};
use serde::{Deserialize, Serialize};

/// Used to keep track of things created by plugins.
/// This can include things like events, commands, etc.
#[derive(Hash, PartialEq, Eq, ToBytes, FromBytes, Serialize, Deserialize)]
#[encoding(Msgpack)] // TODO: Switch to protocal buffers for smaller size
struct Identifier {
namespace: String,
path: String,
}

host_fn!(new(namespace: String, path: String) -> Result<Identifier, _> {
Ok(Identifier { namespace, path })
});
1 change: 1 addition & 0 deletions pumpkin-plugin/src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod identifer;
2 changes: 2 additions & 0 deletions pumpkin-plugin/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mod api;

use std::path::Path;

use extism::{Manifest, Plugin, Wasm};
Expand Down