pub fn putAll(q: *@This(), io: Io, elements: []const Elem) (QueueClosedError || Cancelable)!void q: *@This()io: Ioelements: []const Elem2426
2427
2428
2429
2430
2431
2432 pub fn putAll(q: *@This(), io: Io, elements: []const Elem) (QueueClosedError || Cancelable)!void {
const n = try q.put(io, elements, elements.len);
if (n != elements.len) {
_ = try q.put(io, elements[n..], elements.len - n);
unreachable; // partial `put` implies queue was closed or we were canceled
}
}
Same as
putbut blocks until all elements have been added to the queue.If the queue is closed or canceled,
error.Closedorerror.Canceledis returned, and it is unspecified how many, if any, ofelementswere added to the queue prior to cancelation or closure.