fixup! tests: add top level function tests
This commit is contained in:
parent
64c1a1604d
commit
dc97e44c9e
16
src/nats.zig
16
src/nats.zig
@ -114,7 +114,8 @@ pub fn sign(encoded_seed: [:0]const u8, input: [:0]const u8) Error![]const u8 {
|
||||
|
||||
// Note: an "Inbox" is actually just a string. This API creates a random (unique)
|
||||
// string suitable for passing as the `reply` field to Message.create or
|
||||
// Connection.publishRequest.
|
||||
// Connection.publishRequest. The string is owned by the caller and should be freed
|
||||
// using `destroyInbox`.
|
||||
pub fn createInbox() Error![:0]u8 {
|
||||
var self: [*c]u8 = undefined;
|
||||
const status = Status.fromInt(nats_c.natsInbox_Create(@ptrCast(&self)));
|
||||
@ -122,12 +123,19 @@ pub fn createInbox() Error![:0]u8 {
|
||||
return status.toError() orelse std.mem.sliceTo(self, 0);
|
||||
}
|
||||
|
||||
pub fn destroyInbox(inbox: [:0]const u8) void {
|
||||
nats_c.natsInbox_Destroy(@constCast(@ptrCast(inbox.ptr)));
|
||||
pub fn destroyInbox(inbox: [:0]u8) void {
|
||||
nats_c.natsInbox_Destroy(@ptrCast(inbox.ptr));
|
||||
}
|
||||
|
||||
// I think this is also a jetstream API. This function sure does not seem at all useful
|
||||
// by itself.
|
||||
// by itself. Note: for some reason, most of the jetstream data structures are all
|
||||
// public, instead of following the opaque handle style that the rest of the library
|
||||
// does.
|
||||
|
||||
// typedef struct natsMsgList {
|
||||
// natsMsg **Msgs;
|
||||
// int Count;
|
||||
// } natsMsgList;
|
||||
pub const MessageList = opaque {
|
||||
pub fn destroy(self: *MessageList) void {
|
||||
nats_c.natsMsgList_Destroy(@ptrCast(self));
|
||||
|
Loading…
x
Reference in New Issue
Block a user