pure
    Preparing search index...

    Type Alias Erc<TName, TRepr>

    A holder for an externally ref-counted object.

    See makeErcType for how to use

    type Erc<TName, TRepr = number> = {
        assign: (value: TRepr | undefined) => void;
        free: () => void;
        getStrong: () => Erc<TName, TRepr>;
        getWeak: () => ErcRef<TName, TRepr>;
        take: () => TRepr | undefined;
        type: TName;
        value: TRepr | undefined;
    }

    Type Parameters

    • TName
    • TRepr = number
    Index

    Properties

    assign: (value: TRepr | undefined) => void

    Assign a new value to this Erc.

    The old value will be freed, and all weak references will be invalidated.

    free: () => void

    Free the underlying object.

    All weak references will be invalidated, and this Erc will become empty

    getStrong: () => Erc<TName, TRepr>

    Create a strong reference to the inner value, essentially incrementing the ref count.

    getWeak: () => ErcRef<TName, TRepr>

    Create a weak reference to the inner value.

    When this Erc is freed, all weak references will be invalidated.

    take: () => TRepr | undefined

    Take the inner value without freeing it.

    All weak references will be invalidated, and this Erc will become empty

    type: TName
    value: TRepr | undefined

    Underlying object representation.

    The repr should not be undefinable. undefined means nullptr