Sign in

    mizchi/crater-layout/node does not have a README file

    DispatchFn

    Dispatch function type - passed through layout computation to enable cross-layout-type dispatch without global state. The function takes (node, context, dispatch) and returns Layout.

    LayoutDispatchFunc

    @deprecated Use DispatchFn instead Layout dispatch function type (kept for backward compatibility with incremental compute)

    Node

    pub struct Node {
    id : String
    uid : Int
    style :
    Style

    children : Array[Node]
    measure :
    MeasureFunc
    ?
    text : String?
    src : String?
    }

    A node in the layout tree

    Node::leaf

    fn Node::leaf(id : String, style :
    Style
    ) -> Node

    Node::new

    fn Node::new(id : String, style :
    Style
    , children : Array[Node]) -> Node

    Node::text

    fn Node::text(id : String, style :
    Style
    , measure :
    MeasureFunc
    , content : String) -> Node

    Create a text node with content

    Node::with_measure

    fn Node::with_measure(id : String, style :
    Style
    , measure :
    MeasureFunc
    , text? : String, src? : String?) -> Node

    Create a leaf node with a custom measure function Optional text parameter for alt text (images) or other content

    Node::with_uid

    fn Node::with_uid(id : String, uid : Int, style :
    Style
    , children : Array[Node]) -> Node

    Create a node with a specific uid (for incremental layout)

    Node::with_uid_and_measure

    fn Node::with_uid_and_measure(id : String, uid : Int, style :
    Style
    , children : Array[Node], measure :
    MeasureFunc
    ?, text : String?, src? : String?) -> Node

    Create a node with a specific uid and measure function

    fallback_layout

    Create a minimal fallback layout for a node (used when dispatch is unavailable)

    get_layout_dispatcher

    fn get_layout_dispatcher() -> LayoutDispatchFunc?

    Get the global layout dispatcher

    set_layout_dispatcher

    fn set_layout_dispatcher(f : LayoutDispatchFunc) -> Unit

    Set the global layout dispatcher (used by incremental compute for caching)

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io