moonbitlang/async/aqueue does not have a README file

    Queue

    type Queue[X]

    An asynchronous queue, where reader can wait for data to arrive in a non-blocking manner. The internal buffer size of this queue is unlimited, and writing to the queue will never block.

    Queue::get

    async fn[X] Queue::get(self : Queue[X]) -> X

    Fetch an element from the queue. If the queue is currently empty, get will block and wait until data arrive. If there are multiple readers blocked on get, new data will be delivered in a first-come-first-serve manner.

    get itself never fail, and will wait indefinitely. However, since get is a blocking point, the task running get may be cancelled, in this case, an cancellation will be raised from get.

    Queue::new

    #as_free_fn
    fn[X] Queue::new() -> Queue[X]

    Create an empty queue.

    Queue::put

    fn[X] Queue::put(self : Queue[X], data : X) -> Unit

    Put a new element into a queue. This function never blocks. If the queue is currently empty and there are readers blocked on this thread, one reader will be woken to process the data.

    Queue::try_get

    fn[X] Queue::try_get(self : Queue[X]) -> X?

    Try to fetch an element from the queue without blocking. If no element is in the queue at the moment, None is returned.

    Source Files

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io