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 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
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.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ tokio = { version = "1.39.2", features = ["net", "macros", "rt-multi-thread", "f
rayon = "1.10.0"
uuid = { version = "1.10.0", features = ["serde", "v3"] }
derive_more = { version = "1.0.0", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
2 changes: 1 addition & 1 deletion pumpkin-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version.workspace = true
edition.workspace = true

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde.workspace = true
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
uuid.workspace = true
colored = "2"
Expand Down
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.workspace = true
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
2 changes: 1 addition & 1 deletion pumpkin-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bytes = "1.7"

uuid.workspace = true

serde = { version = "1.0", features = ["derive"] }
serde.workspace = true
# to parse strings to json responses
serde_json = "1.0"

Expand Down
2 changes: 1 addition & 1 deletion pumpkin-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ pumpkin-core = { path = "../pumpkin-core"}
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
fastsnbt = "0.2"

serde = { version = "1.0", features = ["derive"] }
serde.workspace = true
2 changes: 1 addition & 1 deletion pumpkin-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ itertools = "0.13.0"
thiserror = "1.0.63"
futures = "0.3.30"
flate2 = "1.0.33"
serde = { version = "1.0", features = ["derive"] }
serde.workspace = true
serde_json = "1.0"
static_assertions = "1.1.0"
log.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pumpkin-protocol = { path = "../pumpkin-protocol"}
pumpkin-registry = { path = "../pumpkin-registry"}

# config
serde = { version = "1.0", features = ["derive"] }
serde.workspace = true
serde_json = "1.0"
toml = "0.8.19"

Expand Down