connection: eliminate String method variants
After contemplating this for a little bit, there's no point in exposing these separately from the plain variants. Even nats.c internally calls its plain variants after calling `strlen` on the input. Zig benefits from having nicer pointer types than C, so we get "string" handling for free from the fact that the standard variants take slices anyway.
This commit is contained in:
@@ -15,7 +15,7 @@ fn onMessage(
|
||||
});
|
||||
|
||||
if (message.getReply()) |reply| {
|
||||
connection.publishString(reply, "salutations") catch @panic("HELP");
|
||||
connection.publish(reply, "salutations") catch @panic("HELP");
|
||||
}
|
||||
|
||||
userdata.* = true;
|
||||
@@ -30,7 +30,7 @@ pub fn main() !void {
|
||||
defer subscription.destroy();
|
||||
|
||||
while (!done) {
|
||||
const reply = try connection.requestString("channel", "greetings", 1000);
|
||||
const reply = try connection.request("channel", "greetings", 1000);
|
||||
defer reply.destroy();
|
||||
|
||||
std.debug.print("Reply \"{s}\" got message: {s}\n", .{
|
||||
|
Reference in New Issue
Block a user