README

Milky2018/diago/engine_api does not have a README file

#
LayoutEngine

pub(open) trait LayoutEngine {
fn layout(Self,
GraphInput
, LayoutConfig, Direction) ->
LayoutPatch
raise LayoutError
fn engine_name(Self) -> String
fn features(Self) -> Array[LayoutFeature]
}

Layout engine interface.

Engines receive a graph whose object and edge lookup fields use canonical absolute source syntax. They must not mutate the input graph and return a patch whose keys belong to that graph.

#
LayoutError

pub(all) suberror LayoutError {
InvalidGraph(String)
CycleDetected(String)
Unsupported(String)
} derive(Eq,
Debug
)

Layout error
impl Show for LayoutError

#
Direction

pub(all) enum Direction {
Down
Right
Up
Left
} derive(Eq,
Debug
)

Layout direction
impl Show for Direction

#
LayoutConfig

pub struct LayoutConfig {
horizontal_spacing : Double
vertical_spacing : Double
container_padding : Double
default_width : Double
default_height : Double
edge_padding : Double
} derive(
Debug
)

Layout configuration

#
LayoutConfig::new

#
LayoutConfig::with_spacing

fn LayoutConfig::with_spacing(horizontal : Double, vertical : Double) -> LayoutConfig

#
LayoutFeature

pub(all) enum LayoutFeature {
NearObject
ContainerDimensions
TopLeft
DescendantEdges
} derive(Eq,
Debug
)

Layout engine capability flags aligned with the reference's layout feature model.

#
cycle_detected

fn cycle_detected(message : String) -> LayoutError

#
estimate_nested_grid_layout_like_d2

fn estimate_nested_grid_layout_like_d2(parent :
ObjectInput
, child_ids : Array[String], child_size_by_id : Map[String, (Double, Double)], object_by_id : Map[String,
ObjectInput
]) -> (Double, Double, Map[String,
Box
])?

Estimate a real nested grid container, including D2's outside-label margins and container padding, from backend-produced child sizes.

#
estimate_root_grid_child_boxes

fn estimate_root_grid_child_boxes(parent :
ObjectInput
, child_ids : Array[String], child_size_by_id : Map[String, (Double, Double)]) -> Map[String,
Box
]?

#
invalid_graph

fn invalid_graph(message : String) -> LayoutError

Construct an engine_api.LayoutError from outside this package.

#
layout_with_engine

fn[Engine : LayoutEngine] layout_with_engine(engine : Engine, graph :
GraphInput
, config : LayoutConfig, direction : Direction) ->
GraphInput
raise LayoutError

Perform layout on a graph (including variants) with a specific engine.

Returns a new graph with layout applied.

#
unsupported

fn unsupported(message : String) -> LayoutError

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io