Sign in

    moonrockz/diagrams-svg/railroad-layout does not have a README file

    Channel

    pub(all) enum Channel {
    Matched
    NotMatched
    Taken
    Failure
    } derive(Eq,
    Debug
    )

    The four static trace highlight channels.

    Channel::equal

    fn Channel::equal(Channel, Channel) -> Bool

    Channel::not_equal

    fn Channel::not_equal(x : Channel, y : Channel) -> Bool

    Channel::to_repr

    Finding

    pub struct Finding {
    rule : Rule
    identities : ReadOnlyArray[String]
    message : String
    } derive(Eq,
    Debug
    )

    Finding::equal

    fn Finding::equal(Finding, Finding) -> Bool

    Finding::not_equal

    fn Finding::not_equal(x : Finding, y : Finding) -> Bool

    Finding::to_repr

    Frame

    pub struct Frame {
    owner : String
    role : FrameRole
    rect : Rect
    label : Label
    } derive(Eq,
    Debug
    )

    Frame::equal

    fn Frame::equal(Frame, Frame) -> Bool

    Frame::not_equal

    fn Frame::not_equal(x : Frame, y : Frame) -> Bool

    Frame::to_repr

    FrameRole

    pub(all) enum FrameRole {
    Group
    Except
    } derive(Eq,
    Debug
    )

    FrameRole::equal

    fn FrameRole::equal(FrameRole, FrameRole) -> Bool

    FrameRole::not_equal

    fn FrameRole::not_equal(x : FrameRole, y : FrameRole) -> Bool

    Geometry

    pub struct Geometry {
    topology :
    Topology

    width : Double
    height : Double
    title : Label?
    tracks : ReadOnlyArray[TrackBox]
    terms : ReadOnlyArray[TermBox]
    frames : ReadOnlyArray[Frame]
    wires : ReadOnlyArray[Wire]
    notes : ReadOnlyArray[NoteBox]
    // private fields
    }

    Deterministic railroad geometry. Every drawn connector of the topology has one wire; every term has one box.

    Geometry::new

    fn Geometry::new(topology :
    Topology
    , width : Double, height : Double, tracks : ArrayView[TrackBox], terms : ArrayView[TermBox], frames : ArrayView[Frame], wires : ArrayView[Wire], notes : ArrayView[NoteBox], points : ArrayView[(String, Point)], title? : Label) -> Geometry

    Make geometry from parts, for tests of the legibility checker.

    Geometry::point

    fn Geometry::point(self : Geometry, id : String) -> Point?

    The coordinates of a topology point.

    Geometry::points

    fn Geometry::points(self : Geometry) -> Array[(String, Point)]

    Label

    pub struct Label {
    lines : ReadOnlyArray[String]
    x : Double
    size : Double
    weight : Int
    box : Rect
    owner : String
    } derive(Eq,
    Debug
    )

    Measured text. x is the horizontal centre and box the text bounds.

    Label::equal

    fn Label::equal(Label, Label) -> Bool

    Label::not_equal

    fn Label::not_equal(x : Label, y : Label) -> Bool

    Label::to_repr

    Limits

    pub struct Limits {
    nodes : Int
    depth : Int
    work : Int
    width : Int
    output_units : Int
    minimum_approach : Double
    } derive(Eq,
    Debug
    )

    Explicit bounds for railroad layout and painting.

    Limits::equal

    fn Limits::equal(Limits, Limits) -> Bool

    Limits::new

    fn Limits::new(nodes? : Int, depth? : Int, work? : Int, width? : Int, output_units? : Int, minimum_approach? : Double) -> Limits

    Limits::not_equal

    fn Limits::not_equal(x : Limits, y : Limits) -> Bool

    Limits::to_repr

    Limits::with_minimum_approach

    fn Limits::with_minimum_approach(self : Limits, minimum_approach : Double) -> Limits

    Model

    The two railroad source models.

    Model::equal

    fn Model::equal(Model, Model) -> Bool

    Model::not_equal

    fn Model::not_equal(x : Model, y : Model) -> Bool

    Model::to_repr

    NoteBox

    pub struct NoteBox {
    id : String
    rect : Rect
    label : Label
    } derive(Eq,
    Debug
    )

    NoteBox::equal

    fn NoteBox::equal(NoteBox, NoteBox) -> Bool

    NoteBox::not_equal

    fn NoteBox::not_equal(x : NoteBox, y : NoteBox) -> Bool

    NoteBox::to_repr

    Point

    pub(all) struct Point {
    x : Double
    y : Double
    } derive(Eq,
    Debug
    )

    Point::equal

    fn Point::equal(Point, Point) -> Bool

    Point::not_equal

    fn Point::not_equal(x : Point, y : Point) -> Bool

    Point::to_repr

    Rect

    pub(all) struct Rect {
    x : Double
    y : Double
    width : Double
    height : Double
    } derive(Eq,
    Debug
    )

    Rect::contains

    fn Rect::contains(self : Rect, other : Rect, tolerance? : Double) -> Bool

    Rect::equal

    fn Rect::equal(Rect, Rect) -> Bool

    Rect::not_equal

    fn Rect::not_equal(x : Rect, y : Rect) -> Bool

    Rect::overlaps

    fn Rect::overlaps(self : Rect, other : Rect) -> Bool

    Rect::to_repr

    Result

    pub struct Result {
    geometry : Geometry?
    diagnostics : ReadOnlyArray[
    Diagnostic
    ]
    }

    Rule

    pub(all) enum Rule {
    Overlap
    Fit
    Contrast
    Endpoint
    Length
    Limit
    } derive(Eq,
    Debug
    )

    Rule::equal

    fn Rule::equal(Rule, Rule) -> Bool

    Rule::not_equal

    fn Rule::not_equal(x : Rule, y : Rule) -> Bool

    Rule::to_repr

    Shape

    pub(all) enum Shape {
    Pill
    Square
    Class
    Special
    Anchor
    Lookaround
    Dot
    } derive(Eq,
    Debug
    )

    The visual form of a term.

    Shape::equal

    fn Shape::equal(Shape, Shape) -> Bool

    Shape::not_equal

    fn Shape::not_equal(x : Shape, y : Shape) -> Bool

    Shape::to_repr

    TermBox

    pub struct TermBox {
    term :
    Term

    shape : Shape
    rect : Rect
    label : Label
    notes : ReadOnlyArray[Label]
    } derive(Eq,
    Debug
    )

    TermBox::equal

    fn TermBox::equal(TermBox, TermBox) -> Bool

    TermBox::not_equal

    fn TermBox::not_equal(x : TermBox, y : TermBox) -> Bool

    TermBox::to_repr

    TermBox::with_rect

    fn TermBox::with_rect(self : TermBox, rect : Rect) -> TermBox

    The term with another rectangle, for supplied test geometry.

    TrackBox

    pub struct TrackBox {
    track :
    Track

    label : Label
    start : Point
    end : Point
    notes : ReadOnlyArray[Label]
    } derive(Eq,
    Debug
    )

    TrackBox::equal

    fn TrackBox::equal(TrackBox, TrackBox) -> Bool

    TrackBox::not_equal

    fn TrackBox::not_equal(x : TrackBox, y : TrackBox) -> Bool

    TrackBox::to_repr

    Wire

    pub struct Wire {
    connector :
    Connector

    points : ReadOnlyArray[Point]
    label : Label?
    } derive(Eq,
    Debug
    )

    The drawn path of one connector, as a polyline in its semantic direction. Corners are rounded when painted.

    Wire::equal

    fn Wire::equal(Wire, Wire) -> Bool

    Wire::length

    fn Wire::length(self : Wire) -> Double

    The polyline length of a wire.

    Wire::not_equal

    fn Wire::not_equal(x : Wire, y : Wire) -> Bool

    Wire::path

    fn Wire::path(self : Wire, radius? : Double) -> String

    The SVG path data of a wire, with rounded corners.

    Wire::to_repr

    Wire::with_points

    fn Wire::with_points(self : Wire, points : ArrayView[Point]) -> Wire

    The wire with other points, for supplied test geometry.

    channel_color

    The theme colour of a highlight channel.

    check

    fn check(geometry : Geometry, palette :
    Palette
    , work_limit? : Int, highlight_colors? : ArrayView[
    Color
    ]) -> Array[Finding]

    Check attachment, connector length, crossings, label fit and contrast. colors overrides the highlight colours to check, for example caller styles of a trace highlight.

    layout

    fn layout(model : Model, limits? : Limits) -> Result

    Lay out a regex or grammar railroad. Rules stay in source order; each drawn connector of the topology gets one wire.

    svg_number

    fn svg_number(value : Double) -> String

    Format a coordinate for SVG with at most three decimals.

    term_colors

    The fill, stroke and text colours of a term shape in one palette. The painter and the checker use the same choice.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io