Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-foundation

Source of release 0.6.0

0.6.0 / src / gc / support.lucb

#==============================================================================================
#
#   support - Weak<T> and GC::Function<> shapes
#
#   DESCRIPTION:
#       Hand-written generic shapes the generated declarations use: GC::Weak<T> and GC::Function<>
#       (DESIGN.md ยง2.6). Part of the skeleton generator's output (Ladybird 47c82b38d0).
#
#==============================================================================================

## GC::Weak<T> (LibGC/Weak.h): a weak reference through a WeakImpl. Addition: the generation of
## the impl when the Weak was made. The impl goes back to its block when its cell dies, and a Weak
## whose generation no longer matches reads none (weak.lucb).
pub struct Weak[T]:
    pub var m_impl: void*?
    pub var m_generation: u64

## GC::Function<R()>: a cell holding an escaping callback and its captures (scanned conservatively, as LibGC does).
pub struct Function0[R]: IsCell:
    pub var cell_base: Cell
    pub var function: ak.Function0[R]

    pub func cell() -> Cell*: return (Cell*)&self

## GC::Function<R(A1)>: a cell holding an escaping callback and its captures (scanned conservatively, as LibGC does).
pub struct Function1[A1, R]: IsCell:
    pub var cell_base: Cell
    pub var function: ak.Function1[A1, R]

    pub func cell() -> Cell*: return (Cell*)&self

## GC::Function<R(A1, A2)>: a cell holding an escaping callback and its captures (scanned conservatively, as LibGC does).
pub struct Function2[A1, A2, R]: IsCell:
    pub var cell_base: Cell
    pub var function: ak.Function2[A1, A2, R]

    pub func cell() -> Cell*: return (Cell*)&self

## GC::Function<R(A1, A2, A3)>: a cell holding an escaping callback and its captures (scanned conservatively, as LibGC does).
pub struct Function3[A1, A2, A3, R]: IsCell:
    pub var cell_base: Cell
    pub var function: ak.Function3[A1, A2, A3, R]

    pub func cell() -> Cell*: return (Cell*)&self

## GC::Function<R(A1, A2, A3, A4)>: a cell holding an escaping callback and its captures (scanned conservatively, as LibGC does).
pub struct Function4[A1, A2, A3, A4, R]: IsCell:
    pub var cell_base: Cell
    pub var function: ak.Function4[A1, A2, A3, A4, R]

    pub func cell() -> Cell*: return (Cell*)&self

## GC::Function<R(A1, A2, A3, A4, A5)>: a cell holding an escaping callback and its captures (scanned conservatively, as LibGC does).
pub struct Function5[A1, A2, A3, A4, A5, R]: IsCell:
    pub var cell_base: Cell
    pub var function: ak.Function5[A1, A2, A3, A4, A5, R]

    pub func cell() -> Cell*: return (Cell*)&self

## GC::Function<R(A1, A2, A3, A4, A5, A6)>: a cell holding an escaping callback and its captures (scanned conservatively, as LibGC does).
pub struct Function6[A1, A2, A3, A4, A5, A6, R]: IsCell:
    pub var cell_base: Cell
    pub var function: ak.Function6[A1, A2, A3, A4, A5, A6, R]

    pub func cell() -> Cell*: return (Cell*)&self

## GC::Function<R(A1, A2, A3, A4, A5, A6, A7)>: a cell holding an escaping callback and its captures (scanned conservatively, as LibGC does).
pub struct Function7[A1, A2, A3, A4, A5, A6, A7, R]: IsCell:
    pub var cell_base: Cell
    pub var function: ak.Function7[A1, A2, A3, A4, A5, A6, A7, R]

    pub func cell() -> Cell*: return (Cell*)&self

## GC::Function<R(A1, A2, A3, A4, A5, A6, A7, A8)>: a cell holding an escaping callback and its captures (scanned conservatively, as LibGC does).
pub struct Function8[A1, A2, A3, A4, A5, A6, A7, A8, R]: IsCell:
    pub var cell_base: Cell
    pub var function: ak.Function8[A1, A2, A3, A4, A5, A6, A7, A8, R]

    pub func cell() -> Cell*: return (Cell*)&self