crow/col/shared-array.crow (source)

shared-array[t] record shared

(has non-public fields)

    Shared equivalent to 'mut-array'.

    Iteration is not supported; since operations on this take a lock, they need to be short.
    If you need to iterate, you could use 'copy-to' or 'move-to' to get a snapshot of all the elements
    and iterate it at your leisure.

    new[t] t shared-array(...a t array)

    size[t] nat64(a t shared-array)

    is-empty[t] bool(a t shared-array)

    copy-to[t] t array(a t shared-array) unsafe

    WARN: This holds the lock while copying the entire array. Consider using 'move-to' instead.

    move-to[t] t shared-array(a t mut[])

    move-to[t] t array(a t shared-array)

    move-to[t] t mut[](a t shared-array)

    clear[t] void(a t shared-array)

    ~=[t] void(a t shared-array, value t)

    subscript[t] t(a t shared-array, index nat64)

    build[t] t shared-array(a build-options, f mut void(t mut[]))