Skip to content

Commit

Permalink
chore: use namespaced ExtismValType
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed May 20, 2024
1 parent 4ed53e1 commit e1942ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,16 @@ defer KV_STORE.deinit();
var f_read = extism.Function.init(
"kv_read",
&[_]extism.c.ExtismValType{extism.c.I64},
&[_]extism.c.ExtismValType{extism.c.I64},
&[_]extism.c.ExtismValType{extism.PTR},
&[_]extism.c.ExtismValType{extism.PTR},
&kv_read,
@constCast(@as(*const anyopaque, @ptrCast("user data"))),
);
defer f_read.deinit();
var f_write = extism.Function.init(
"kv_write",
&[_]extism.c.ExtismValType{extism.c.I64, extism.c.I64},
&[_]extism.c.ExtismValType{extism.PTR, extism.PTR},
&[_]extism.c.ExtismValType{},
&kv_write,
@constCast(@as(*const anyopaque, @ptrCast("user data"))),
Expand Down
2 changes: 1 addition & 1 deletion src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ pub fn extismVersion() []const u8 {
return version;
}

pub const PTR = c.I64;
pub const PTR = c.ExtismValType_I64;
18 changes: 9 additions & 9 deletions test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ test "Single threaded tests" {

var f = Function.init(
"hello_world",
&[_]sdk.c.ExtismValType{sdk.c.I64},
&[_]sdk.c.ExtismValType{sdk.c.I64},
&[_]sdk.c.ExtismValType{sdk.c.ExtismValType_I64},
&[_]sdk.c.ExtismValType{sdk.c.ExtismValType_I64},
&hello_world,
@constCast(@as(*const anyopaque, @ptrCast("user data"))),
);
Expand Down Expand Up @@ -76,8 +76,8 @@ test "Multi threaded tests" {
fn _test() !void {
var f = Function.init(
"hello_world",
&[_]sdk.c.ExtismValType{sdk.c.I64},
&[_]sdk.c.ExtismValType{sdk.c.I64},
&[_]sdk.c.ExtismValType{sdk.c.ExtismValType_I64},
&[_]sdk.c.ExtismValType{sdk.c.ExtismValType_I64},
&hello_world,
@constCast(@as(*const anyopaque, @ptrCast("user data"))),
);
Expand All @@ -96,8 +96,8 @@ test "Multi threaded tests" {

var f = Function.init(
"hello_world",
&[_]sdk.c.ExtismValType{sdk.c.I64},
&[_]sdk.c.ExtismValType{sdk.c.I64},
&[_]sdk.c.ExtismValType{sdk.c.ExtismValType_I64},
&[_]sdk.c.ExtismValType{sdk.c.ExtismValType_I64},
&hello_world,
@constCast(@as(*const anyopaque, @ptrCast("user data"))),
);
Expand All @@ -116,8 +116,8 @@ test "Plugin Cancellation" {
_ = sdk.setLogFile("test.log", .Debug);
var f = Function.init(
"hello_world",
&[_]sdk.c.ExtismValType{sdk.c.I64},
&[_]sdk.c.ExtismValType{sdk.c.I64},
&[_]sdk.c.ExtismValType{sdk.c.ExtismValType_I64},
&[_]sdk.c.ExtismValType{sdk.c.ExtismValType_I64},
&hello_world,
@constCast(@as(*const anyopaque, @ptrCast("user data"))),
);
Expand All @@ -128,7 +128,7 @@ test "Plugin Cancellation" {
var handle = plugin.cancelHandle();
const S = struct {
fn _test(h: *sdk.CancelHandle) void {
std.os.nanosleep(1, 0);
std.time.sleep(1);
_ = h.cancel();
}
};
Expand Down

0 comments on commit e1942ff

Please sign in to comment.