where you must not return out.RoutingId because of leaking memory.
To use following:
const routing_id = try routingId(allocator, socket);
defer allocator.free(routing_id);
someMethod(
std.mem.sliceTo(routing_id, 0) // because a size of routing_id is 256
);
If you ingest inside scope, you'll use a fixed size array.
var routing_id: [256:0]u8 = undefined;
var opt: zmq.ZSocketOption = .{.RoutingId = &routing_id};
try socket.getSocketOption(&opt);
// (snip) ingesting...
ZSocket
is supportedRoutingId
option. When you get this option, you must provide buffer.What is buffer size? In specification, this buffer size is defined as 255 chars + null termination char.
If you takeaway the routing id outside scope, this buffer must be heap allocation.
where you must not return
out.RoutingId
because of leaking memory.To use following:
If you ingest inside scope, you'll use a fixed size array.