pub fn get(q: *@This(), io: Io, buffer: []Elem, min: usize) (QueueClosedError || Cancelable)!usize q: *@This()io: Iobuffer: []Elemmin: usize2474
2475
2476 pub fn get(q: *@This(), io: Io, buffer: []Elem, min: usize) (QueueClosedError || Cancelable)!usize {
return @divExact(try q.type_erased.get(io, @ptrCast(buffer), min * @sizeOf(Elem)), @sizeOf(Elem));
}
Receives elements from the beginning of the queue, potentially blocking if there are insufficient elements currently in the queue. Returns when any one of the following conditions is satisfied:
minelements have been received from the queueReturns how many elements of
bufferhave been populated, if any. If an error is returned, no elements have been populated.If the queue is closed or the task is canceled, but some items were already received before the closure or cancelation, then
getmay 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 fill as much ofbufferas is possible without blocking.Asserts that
buffer.len >= min.