Skip to content

refactor(render): split layout.rs into a layout module (#3068) - #3073

Merged
jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:refactor/3068-split-render-layout
Nov 27, 2026
Merged

jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:refactor/3068-split-render-layout

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Splits crates/render/src/layout.rs into a layout module, with no change in behaviour, so that changes to different layout elements stop editing the same file.

File What it holds
layout.rs page rendering, the element dispatch (draw_page) and the helpers several elements share
layout/legend.rs, swatch.rs the legend and its symbols
layout/chart.rs, table.rs, colorbar.rs, scale_bar.rs, north.rs, textbox.rs one element each
layout/frame.rs, grid.rs, coverage.rs map frames, their grid and their coverage
layout/dynamic_text.rs, losses.rs text tokens, and what a page's texts lose
layout/tests.rs the former mod tests, whole

How to review: git diff --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change main...HEAD.

  • Items move whole. layout.rs re-exports each submodule, so rustgis_render::layout::… and crate::layout::… paths are unchanged and no file outside the module changes.
  • The edits inside the moved code are private items, fields and inherent methods becoming pub(super) (visible to the layout module, as they were to the file), and the rewrapping cargo fmt does after that and after the tests lose one level of indentation. String literals are not re-indented.
  • Each new file adds a one-line //! doc comment and use super::*;.
  • The script below made the change. It stops on an item it doesn't know, and checks before formatting that every moved segment is byte-identical to the original.
The script (run from the repository root, on a checkout with the unsplit file)
#!/usr/bin/env python3
"""Split crates/render/src/layout.rs into a `layout` module, moving whole items.

Usage, from the root of a RustGIS checkout whose layout.rs is unsplit:

    python3 -I partir_render_layout.py

An item missing from MAP stops the script: add it to the right list, never move it by hand.
The only edit inside moved code is private items, fields and inherent methods becoming
`pub(super)`; the tests lose one level of indentation (never inside a string literal).
Both edits are undone and compared byte for byte with the original before anything is written.
`cargo fmt` runs last and rewraps the lines whose width the two edits changed.
"""

import re
import subprocess
import sys
from pathlib import Path

SRC = Path("crates/render/src/layout.rs")
DIR = Path("crates/render/src/layout")

ROOT = """PageInfo series_env frame_style_env frame_page_env MAX_SIDE MAX_PIXELS frame_requires_complete
archive_revisions render render_region meets PagePending render_pending render_page render_pending_inner
render_drawing render_drawing_inner page_geometry render_element record_element element_bounds draw_page
dashed draw_background rounded_rect decimal placeholder shape fill map_index plain_text_pages"""

MAP = {
    "losses": """clipped_text TextLoss UnitLabelCut text_losses text_loss bar_labels_cut losses
        clipped_text_notice scale_bar_fit_notices lines_left_out_notice off_page_notice""",
    "dynamic_text": """scale_ratio_text expand statistic_notices map_statistic_notices notices_over statistics
        statistic_figures distinct_stat_tokens figures_of""",
    "frame": """frame_map frame_canvas frame_map_preview frame_map_preview_with finish_frame attribution_inset
        shape_path frame_outline_lonlat Georeferenced MAX_CORNER_FIT_MM frame_viewports MAX_VIEWPORTS_A_FRAME
        MIN_STRIP_MM uncovered corner_fit_mm frame_viewport ring_on_flat outline_lonlat""",
    "grid": """grid_label graticule_lines MAX_MEASURED_LINES WIDENED_LINES measured_lines edge_crossings Edge
        measured_crs nice_step draw_grid MGRS_LABEL_PT MGRS_SAMPLES mgrs_squares kept_labels rotated_text""",
    "north": "north_arrow",
    "scale_bar": """scale_number bar_number BAR_SHARE BAR_INSET BAR_LABEL_RISE BAR_LABEL_MID BarPlan bar_plan
        bar_label scale_bar_width_pt scale_bar_box_width_pt bar_inset BarOptions BarFit bar_fit BarLayout
        BarUnit bar_layout scale_bar last_label shortened BarRows bar_rows""",
    "legend": """shown_legends legend_lists layer_shown raster_classes failed_source_error complete_shown_legends
        LegendOptions legend_size LegendRow flow balanced column_parts widest row_strokes row_fills
        swatch_column picture_size tile_listed tile_legend tile_legends_pending on_page legends_pending
        finish_legends LEGEND_WAIT thread_local LegendBudget legend_budget legend_deadline wait_for_tile_legends
        MAX_LEGEND_SIDE RASTER_SWATCH_EDGE LEGEND_ROW LEGEND_TITLE_PT LEGEND_NAME_PT LEGEND_LABEL_PT
        LEGEND_TITLE_ROWS LEGEND_INDENT LEGEND_LABEL_INDENT LEGEND_SWATCH LEGEND_COLUMN_GAP legend_rows
        legend_rows_missing legend_missing legend legend_column picture_scale legend_picture legend_sizes_mm
        legend_sizes_with_no_data_mm legend_title_mm""",
    "coverage": """frame_render_scale only_outlines plain_fill frame_coverage context_layers
        frame_coverage_judged_on frame_plain_under""",
    "swatch": """swatch swatch_ink swatch_line_path flat_swatch_outline swatch_across swatch_line swatch_box
        flat_swatch stacked_swatch draw_point point_swatch composited""",
    "colorbar": """Bar tick_labels ColorbarPlan colorbar_plan colorbar COLORBAR_TITLE_PT colorbar_title_style
        colorbar_title_width_mm COLORBAR_TITLE_SLACK_MM colorbar_title_lines colorbar_title_drawn
        colorbar_bar_room""",
    "textbox": """TextStyle text_style WRAP_PX_PER_MM wrapped drawn_text MAX_TEXT_LINES text_shift block_shift
        wrapped_lines USUAL_LINE_SPACING line_pitch_mm text_area draw_turned_box text_block""",
    "table": "table",
    "chart": """chart chart_span chart_head chart_crowded reach chart_key fit_label ChartBars mirrored""",
}

HEADERS = {
    "losses": "What a page's texts lose: cut lines, boxes off the page, and the notices that say so.",
    "dynamic_text": "The tokens a layout's texts hold: page, scale and a layer's statistics.",
    "frame": "Map frames: their picture, outline and georeferenced viewports.",
    "grid": "A map frame's grid: graticule, measured and MGRS lines, and their labels.",
    "north": "The north arrow.",
    "scale_bar": "The scale bar: its plan, fit and drawing.",
    "legend": "The legend: its rows, columns, sizes and the wait for service legend pictures.",
    "coverage": "How much of a map frame its layers cover.",
    "swatch": "The symbol a legend row shows.",
    "colorbar": "The colorbar and its title.",
    "textbox": "Text in a box: style, wrapping, vertical alignment and drawing.",
    "table": "The attribute table element.",
    "chart": "The chart element: bars, values and key.",
}

HEADER_RE = re.compile(
    r"^(?P<vis>pub(?:\([a-z]+\))? )?(?:(?:const|async) (?=fn ))?"
    r"(?P<kind>fn|struct|enum|const|static|type|trait|mod) (?P<name>[A-Za-z_][A-Za-z0-9_]*)"
)
THREAD_LOCAL = "thread_local! {"
IMPL_RE = re.compile(r"^impl(?:<[^>]*>)? (?:(?P<trait>[A-Za-z_:]+) for )?(?P<name>[A-Za-z_][A-Za-z0-9_]*)")


def die(msg):
    sys.exit(f"STOP: {msg}")


def scan(text):
    """For each line: (starts inside a string, brace depth after it, its code without strings and comments)."""
    out = []
    i, n = 0, len(text)
    depth, comment, string = 0, 0, None  # string: None, '"', or the closing text of a raw string
    code, starts_in_string = [], False
    while i < n:
        c = text[i]
        if c == "\n":
            out.append((starts_in_string, depth, "".join(code).rstrip()))
            code, starts_in_string = [], string is not None
            i += 1
            continue
        if comment:
            if text.startswith("*/", i):
                comment -= 1
                i += 2
            elif text.startswith("/*", i):
                comment += 1
                i += 2
            else:
                i += 1
            continue
        if string is not None:
            if string == '"' and c == "\\":
                i += 1 if text[i + 1] == "\n" else 2
            elif text.startswith(string, i):
                i += len(string)
                string = None
            else:
                i += 1
            continue
        if text.startswith("//", i):
            i = text.index("\n", i)
            continue
        if text.startswith("/*", i):
            comment, i = 1, i + 2
            continue
        raw = re.compile(r'(?<![A-Za-z0-9_])(?:b|c)?r(#*)"').match(text, i)
        if raw:
            string, i = '"' + raw.group(1), raw.end()
            continue
        if c == '"':
            string, i = '"', i + 1
            continue
        if c == "'":
            ch = re.compile(r"'(?:\\u\{[0-9a-fA-F]+\}|\\x[0-9a-fA-F]{2}|\\.|[^\\'\n])'").match(text, i)
            i = ch.end() if ch else i + 1  # else a lifetime or a label
            continue
        if c == "{":
            depth += 1
        elif c == "}":
            depth -= 1
        code.append(c)
        i += 1
    if depth or comment or string is not None:
        die("the lexer ended unbalanced")
    return out


def split_items(lines, info):
    """Segments covering the code before the tests: (name, kind, is_trait_impl, lines)."""
    items, start, i = [], None, 0
    first = next(k for k, l in enumerate(lines) if HEADER_RE.match(l) or IMPL_RE.match(l) or l.startswith("#["))
    while first and lines[first - 1].startswith(("//", "#[")):
        first -= 1
    preamble, i = lines[:first], first
    start = first
    while i < len(lines):
        head = HEADER_RE.match(lines[i])
        impl = IMPL_RE.match(lines[i])
        local = lines[i] == THREAD_LOCAL
        if not head and not impl and not local:
            s = lines[i]
            if s and not s.startswith(("//", "#[", " ", ")]")):
                die(f"unreadable top-level line {i + 1}: {s!r}")
            i += 1
            continue
        end = i
        while not (info[end][1] == 0 and info[end][2].endswith(("}", ";"))):
            end += 1
        if local:
            items.append(("thread_local", "thread_local", False, lines[start : end + 1]))
        elif impl:
            items.append((impl["name"], "impl", bool(impl["trait"]), lines[start : end + 1]))
        else:
            items.append((head["name"], head["kind"], False, lines[start : end + 1]))
        start = i = end + 1
    return preamble, items, lines[start:]


def widen(seg, kind, is_trait):
    """`pub(super)` on what was private to the file. Returns the new lines and the edited indices."""
    info = scan("\n".join(seg) + "\n")
    out, edited, depth_before, inside = list(seg), [], 0, False
    for k, line in enumerate(seg):
        in_string, depth, code = info[k]
        new = line
        if not in_string:
            head = HEADER_RE.match(line)
            if depth_before == 0 and (head or IMPL_RE.match(line) or line == THREAD_LOCAL):
                inside = True
                if head and not head["vis"]:
                    new = "pub(super) " + line
            elif inside and depth_before == 1:
                if kind == "struct":
                    new = re.sub(r"^    (?=[a-z_][A-Za-z0-9_]*\s*:(?!:))", "    pub(super) ", line)
                elif kind == "impl" and not is_trait:
                    new = re.sub(r"^    (?=(?:(?:const|async) )?fn |const [A-Z])", "    pub(super) ", line)
                elif kind == "thread_local":
                    new = re.sub(r"^    (?=static )", "    pub(super) ", line)
        if new != line:
            out[k] = new
            edited.append(k)
        depth_before = depth
    return out, edited


def main():
    if not SRC.is_file() or DIR.exists():
        die(f"run at the root of a checkout with {SRC} and no {DIR}/")
    text = SRC.read_text(encoding="utf-8")
    if not text.endswith("\n"):
        die("no final newline")
    lines = text[:-1].split("\n")
    info = scan(text)
    marks = [k for k in range(len(lines) - 1) if lines[k] == "#[cfg(test)]" and lines[k + 1] == "mod tests {"]
    if len(marks) != 1 or lines[-1] != "}":
        die("expected one trailing `mod tests`")
    cut = marks[0]

    owner = {name: file for file, names in MAP.items() for name in names.split()}
    for name in ROOT.split():
        if name in owner:
            die(f"{name} is listed twice")
        owner[name] = "root"
    if len(owner) != len(ROOT.split()) + sum(len(v.split()) for v in MAP.values()):
        die("a name is listed twice")

    preamble, items, tail = split_items(lines[:cut], info[:cut])
    unknown = sorted({name for name, *_ in items if name not in owner})
    if unknown:
        die(f"items not in MAP: {' '.join(unknown)}")
    rebuilt = preamble + [l for *_, seg in items for l in seg] + tail
    if rebuilt != lines[:cut]:
        die("the segments do not cover the file")

    files = {file: [] for file in MAP}
    root = list(preamble)
    visibility = {file: set() for file in MAP}
    for name, kind, is_trait, seg in items:
        file = owner[name]
        if file == "root":
            root += seg
            continue
        new, edited = widen(seg, kind, is_trait)
        undone = [l.replace("pub(super) ", "", 1) if k in edited else l for k, l in enumerate(new)]
        if undone != seg:
            die(f"{name} changed beyond pub(super)")
        files[file] += new
        for l in new:
            head = HEADER_RE.match(l)
            if head:
                visibility[file].add((head["vis"] or "").strip())

    # The tests, one indentation level less, except inside string literals.
    body = list(range(cut + 2, len(lines) - 1))
    tests, dedented = [], []
    for k in body:
        line = lines[k]
        if not info[k][0] and line:
            if not line.startswith("    "):
                die(f"test line {k + 1} is not indented: {line!r}")
            tests.append(line[4:])
            dedented.append(True)
        else:
            tests.append(line)
            dedented.append(False)
    if ["    " + l if d else l for l, d in zip(tests, dedented)] != [lines[k] for k in body]:
        die("the tests do not rebuild")

    decls = []
    for file in MAP:
        if not files[file]:
            die(f"{file} is empty")
        # A glob re-exports no more than its widest item; a wider `use` is a warning.
        vis = "pub " if "pub" in visibility[file] else "pub(crate) " if "pub(crate)" in visibility[file] else ""
        decls.append((file, vis))
    last_use = max(k for k, l in enumerate(root) if l.startswith("use "))
    mods = [""] + [f"mod {f};" for f, _ in sorted(decls)] + [""] + [f"{v}use {f}::*;" for f, v in sorted(decls)]
    root[last_use + 1 : last_use + 1] = mods
    while tail and not tail[-1]:
        tail.pop()
    root += tail + ["", "#[cfg(test)]", "mod tests;"]

    DIR.mkdir()
    for file, seg in files.items():
        while seg and not seg[0]:
            seg = seg[1:]
        out = [f"//! {HEADERS[file]}", "", "use super::*;", ""] + seg
        (DIR / f"{file}.rs").write_text("\n".join(out) + "\n", encoding="utf-8")
    (DIR / "tests.rs").write_text("\n".join(tests) + "\n", encoding="utf-8")
    SRC.write_text("\n".join(root) + "\n", encoding="utf-8")

    subprocess.run(["cargo", "fmt", "-p", "rustgis-render"], check=True)
    for path in [SRC, *sorted(DIR.glob("*.rs"))]:
        print(f"{len(path.read_text(encoding='utf-8').splitlines()):6d}  {path}")
    print(f"OK: {len(items)} items, every segment identical to the original before formatting")


if __name__ == "__main__":
    main()

Suggested AGENTS.md additions: new layout drawing tests go in crates/render/src/layout/tests/<topic>.rs, not at the end of layout/tests.rs.

Testing

On this commit, on Linux:

  • cargo nextest list -p rustgis-render gives the same list before and after the script (178 tests under layout::tests::).
  • cargo nextest run --workspace (all but the two local DuckDB tests, which don't run on this machine): 9880 passed, 29 skipped; doctests pass.
  • cargo fmt --all --check, cargo clippy -p rustgis-render --all-targets -- -D warnings, cargo xtask layers, cargo xtask schema --check (with its clippy on the schema feature), cargo xtask test-hygiene and cargo xtask rows pass.
  • RUSTFLAGS='-D warnings' cargo build --locked --target wasm32-unknown-unknown -p rustgis-web passes.

Reach: no behaviour changes on any surface (desktop, browser, command line, Python, phone), and no command, parameter, project format or interface text changes.

UI evidence

No visible UI change.

Related issue

Closes #3068

Summary by CodeRabbit

  • New Features
    • Added layout elements for charts, legends, colorbars, scale bars, data tables, and north arrows.
    • Map frames can display grids, labels, and attribution, with improved support for different projections.
    • Layout text can show dynamic map, page, scale, and layer-statistic values.
    • Added checks that flag text or labels that may be clipped, omitted, or crowded.
    • PDF exports can include georeferencing for supported map frames.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The layout rendering code is split into modules for element families, and layout.rs declares and re-exports them. The layout test suite is moved to tests.rs. The modules contain rendering and layout logic for frames, grids, legends, charts, text, scale bars, colorbars, north arrows, and tables.

Changes: Layout Rendering Modules

Layer / File(s) Summary
Module declarations and extraction
crates/render/src/layout.rs, crates/render/src/layout/tests.rs
layout.rs declares and re-exports the rendering modules, retains local helpers, and declares the test module.
Frames, coverage, and grids
crates/render/src/layout/frame.rs, crates/render/src/layout/coverage.rs, crates/render/src/layout/grid.rs, crates/render/src/layout/tests.rs
Separate modules implement map-frame rendering, coverage sampling, PDF viewport generation, and grid drawing. Tests cover frames, coverage, projections, grids, and attribution placement.
Legend rows, pictures, and swatches
crates/render/src/layout/legend.rs, crates/render/src/layout/swatch.rs, crates/render/src/layout/tests.rs
Legend construction, sizing, rendering, and pending-picture handling are implemented alongside symbol swatches. Tests cover legend layout, picture handling, and swatch rendering.
Text, dynamic content, and loss notices
crates/render/src/layout/textbox.rs, crates/render/src/layout/dynamic_text.rs, crates/render/src/layout/losses.rs, crates/render/src/layout/tests.rs
Separate modules implement text rendering, dynamic token expansion, and text-loss detection. Tests cover text layout, clipping, and statistic tokens.
Charts and colorbars
crates/render/src/layout/chart.rs, crates/render/src/layout/colorbar.rs, crates/render/src/layout/tests.rs
Separate modules implement chart and colorbar layout and rendering. Tests cover chart values and styles, colorbar labels, and title limits.
Scale bars, north arrows, and tables
crates/render/src/layout/scale_bar.rs, crates/render/src/layout/north.rs, crates/render/src/layout/table.rs, crates/render/src/layout/tests.rs
Separate modules implement scale-bar planning and drawing, north-arrow drawing, and table rendering. Tests cover scale-bar behavior and north-arrow styles.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Refactor

Suggested reviewers: m-hollis-1, giswqs

Merge Risk: Minimal · up to 70fcc

This change moves layout rendering code and its tests into separate files and keeps the existing module paths working. No concrete regression was found, and the author reports unchanged test results. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "refactor(render): split layout.rs into a layout module (#3068)" matches the main change. The PR splits crates/render/src/layout.rs into a layout module with element-family submodules and a …
Description check Passed The description follows the template. It has a Summary that explains the split and why (changes stop colliding in one file). It has a Testing section with concrete commands and results. It has a UI ev…
Linked Issues check Passed Issue #3068 requires splitting crates/render/src/layout.rs into a layout module with per-family files, keeping page rendering and dispatch in layout.rs, re-exporting so existing paths hold, moving the…
Out of Scope Changes check Passed The changes stay within crates/render/src/layout.rs and the new crates/render/src/layout/ directory. Per the PR description and raw summary, the PR changes no file outside the module. The moved code k…
Full details: Title check

Explanation

The title "refactor(render): split layout.rs into a layout module (#3068)" matches the main change. The PR splits crates/render/src/layout.rs into a layout module with element-family submodules and a tests.rs file, with no behaviour change. The title is specific and conventional. The trailing issue number is minor noise.

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains the split and why (changes stop colliding in one file). It has a Testing section with concrete commands and results. It has a UI evidence section that states 'No visible UI change.', as the template allows. It has a Related issue section that closes #3068. The description also includes a file table, review instructions, and a full script. The script is long, but it supports the verification claims.

Full details: Linked Issues check

Explanation

Issue #3068 requires splitting crates/render/src/layout.rs into a layout module with per-family files, keeping page rendering and dispatch in layout.rs, re-exporting so existing paths hold, moving the existing tests into layout/tests.rs, and making no behaviour change. At the reviewed head, layout.rs declares mod chart, colorbar, coverage, dynamic_text, frame, grid, legend, losses, north, scale_bar, swatch, table, textbox, and mod tests (via layout/tests.rs). It keeps PageInfo, series_env, render, render_region, render_pending, render_drawing, page_geometry, render_element, record_element, element_bounds, and draw_page. It re-exports the submodules with pub use or use. The layout/ directory contains all 13 named files plus tests.rs. The files are moved code with pub(super) widening, per the PR description and the raw summary. Behaviour preservation rests on the author's reported checks (nextest list equality, nextest run, clippy, fmt, wasm build). Those runs were not re-executed in this review. The script in the PR description is delivered in the description, not as a repository file. Future-test guidance (layout/tests/<topic>.rs) is suggested as AGENTS.md text and is not a coding requirement of this PR. No unmet coding requirement is established.

Full details: Out of Scope Changes check

Explanation

The changes stay within crates/render/src/layout.rs and the new crates/render/src/layout/ directory. Per the PR description and raw summary, the PR changes no file outside the module. The moved code keeps its behaviour. The only edits inside moved code are pub(super) visibility changes, the cargo fmt rewrapping, and one indentation level removed from the tests. The added //! headers and use super::* lines serve the split. No unrelated change was found in the reviewed evidence.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit hops where modules part,
Each layout piece gets its own chart.
The grids and legends find their place,
While tests move in a steady trace.
I nibble carrots, pleased to see,
New files keep the layout tidy.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f2f8dcb9-217b-4b17-a2d5-13511ae3a2a7
Commits

Reviewing files that changed from the base of the PR and between 3c39bbc and 70fcc92.

Files selected for processing: 15

  • crates/render/src/layout.rs
  • crates/render/src/layout/chart.rs
  • crates/render/src/layout/colorbar.rs
  • crates/render/src/layout/coverage.rs
  • crates/render/src/layout/dynamic_text.rs
  • crates/render/src/layout/frame.rs
  • crates/render/src/layout/grid.rs
  • crates/render/src/layout/legend.rs
  • crates/render/src/layout/losses.rs
  • crates/render/src/layout/north.rs
  • crates/render/src/layout/scale_bar.rs
  • crates/render/src/layout/swatch.rs
  • crates/render/src/layout/table.rs
  • crates/render/src/layout/tests.rs
  • crates/render/src/layout/textbox.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Pure file split of crates/render/src/layout.rs into a layout/ module with no intended behaviour change. I found no bugs, security issues, performance regressions or AGENTS.md breaks. I posted no inline comments because there was nothing specific to anchor. I could not compile or run tests here (no shell), so the "identical output" claim rests on reading, not on a build.

Bugs: None found. Checked:

  • Every moved item is accounted for by the layout.rs root: its mod/pub use/use block (lines 21–47) covers all 13 submodules, and the #[cfg(test)] mod tests; is at the end (lines 861–862).
  • Visibility edits are limited to pub(super) on items, fields, inherent methods and thread-locals. Trait impls (Drop, Default, Probe) are not widened, and no pub item was narrowed.
  • Re-exported paths are unchanged: pub use is used only for submodules that hold pub items, and the private use north::* / swatch / table globs hold only pub(super) items.
  • Spot-read north.rs, table.rs, the head of tests.rs and the tail of layout.rs. The local shape closure in north.rs shadows the outer shape only after its own definition, so it resolves to the outer function.
  • No file in the repo, including xtask/, docs or tests, refers to crates/render/src/layout.rs by path. cargo xtask rows keys its ratchet by package, so moving code inside rustgis-render does not change its counts.

Security: None. No new I/O, parsing or external input.

Performance: None. The split adds no runtime work. Compile-time impact is not measured.

Quality:

  • layout/tests.rs is now one 6,820-line file (about 360 KB). The PR body already proposes per-topic test files for future work, so this can wait for the release quality pass.
  • Confidence: high that this is a nit; no change needed in this PR.

AGENTS.md: None. The "Suggested AGENTS.md additions" line in the PR body is for the maintainer to decide and is not a rule break.

Already raised: 0 earlier concerns, since prior-reviews.json has no threads.

Change size

Compared with the base branch (merge base 25d0786 to PR head 70fcc92), the whole PR. Trees were not truncated.

Measure Value
Files changed 15 (14 added, 1 modified, 0 removed, 0 renamed)
Size before 656.1 KB
Size after 633.0 KB
Total size change -23.2 KB
Path Before After Change
crates/render/src/layout.rs 656.1 KB 42.1 KB -614.1 KB
crates/render/src/layout/tests.rs 0 B 359.8 KB +359.8 KB
crates/render/src/layout/legend.rs 0 B 36.8 KB +36.8 KB
crates/render/src/layout/scale_bar.rs 0 B 33.0 KB +33.0 KB
crates/render/src/layout/frame.rs 0 B 29.0 KB +29.0 KB
crates/render/src/layout/grid.rs 0 B 24.3 KB +24.3 KB
crates/render/src/layout/losses.rs 0 B 22.1 KB +22.1 KB
crates/render/src/layout/chart.rs 0 B 20.3 KB +20.3 KB
crates/render/src/layout/colorbar.rs 0 B 13.8 KB +13.8 KB
crates/render/src/layout/swatch.rs 0 B 12.8 KB +12.8 KB
crates/render/src/layout/textbox.rs 0 B 12.7 KB +12.7 KB
crates/render/src/layout/coverage.rs 0 B 11.6 KB +11.6 KB
crates/render/src/layout/dynamic_text.rs 0 B 9.0 KB +9.0 KB
crates/render/src/layout/north.rs 0 B 2.9 KB +2.9 KB
crates/render/src/layout/table.rs 0 B 2.7 KB +2.7 KB

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3073/
Web app https://preview.rustgis.app/pr-3073/app/
Commit 70fcc92

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 27, 2026
Merged via the queue into opengeos:main with commit b5314c4 Nov 27, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the refactor/3068-split-render-layout branch November 27, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Split crates/render/src/layout.rs into a layout module, with no change in behaviour

1 participant