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.

    DispatchFn::inner

    #deprecated("Use `struct T(A)` to declare a newtype and use `.0` access the underlying type instead.")
    fn DispatchFn::inner(self : DispatchFn) -> ((Node,
    LayoutContext
    , DispatchFn) ->
    Layout
    )
    Convert newtype to its underlying type, automatically derived.

    LayoutDispatchFunc

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

    LayoutDispatchFunc::inner

    #deprecated("Use `struct T(A)` to declare a newtype and use `.0` access the underlying type instead.")
    fn LayoutDispatchFunc::inner(self : LayoutDispatchFunc) -> ((Node,
    LayoutContext
    ) ->
    Layout
    )
    Convert newtype to its underlying type, automatically derived.

    Node

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

    children : Array[Node]
    measure :
    MeasureFunc
    ?
    text : 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) -> 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?) -> 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