class

Async::Queue(T)

Inherits Enumerable / Reference / Object

First in, first out (FIFO) queue based on Python's own asyncio.Queue.

Constructors

new(max_size : Int32 | Nil = nil)

Initializes a new Queue.

If max_size is less than or equal to zero, the queue size is infinite. If it is an integer greater than 0, then await #put blocks when the queue reaches max_size until an item is removed by #get.

Source

Instance methods

each

Iterate over each item in the queue. See Array#each.

Source
empty?

Returns true if the queue is empty.

Source
full?

Returns true if there are max_size items in the queue.

Source
get

Remove and return an item from the queue. If the queue is empty, wait until an item is available.

Source
get!

Return an item if one is immediately available, else raise QueueEmptyError.

Source
get_sync

Remove and return an item from the queue. If the queue is empty, wait until an item is available.

Source
max_size

Returns the set max size for the queue.

Source
push!(item : T)

Put an item into the queue without blocking. If no free slot is immediately available, raise QueueFullError.

Source
put(item : T)

Put an item into the queue. If the queue is full, wait until a free slot is available before adding the item.

Source
put_sync(item : T)
Source
size

Returns the number of items in the queue.

Source