pub fn put(q: *@This(), io: Io, elements: []const Elem, min: usize) (QueueClosedError || Cancelable)!usize q: *@This()io: Ioelements: []const Elemmin: usize2417
2418
2419 pub fn put(q: *@This(), io: Io, elements: []const Elem, min: usize) (QueueClosedError || Cancelable)!usize {
return @divExact(try q.type_erased.put(io, @ptrCast(elements), min * @sizeOf(Elem)), @sizeOf(Elem));
}
Appends elements to the end of the queue, potentially blocking if there is insufficient capacity. Returns when any one of the following conditions is satisfied:
minelements have been added to the queueReturns how many of
elementshave been added to the queue, if any. If an error is returned, no elements have been added.If the queue is closed or the task is canceled, but some items were already added before the closure or cancelation, then
putmay return a number lower thanmin, in which case future calls are guaranteed to returnerror.Canceledorerror.Closed.A return value of 0 is only possible if
minis 0, in which case the call is guaranteed to queue as many ofelementsas is possible without blocking.Asserts that
elements.len >= min.