Skip to content
FutureBlitz

    Install

    Import std.term.region

    Constraint

    std.term.region

    struct

    Public Struct Constraint Implements Hashable, Printable

    How big one part of a split is: a Fixed number of cells, a Percent of the cells there are, at least a Min of them and a share of what's left like a Fill of 1, or a Fill, a share of what's left by its weight beside the other Fills'.

    Examples

    Expect("{Constraint.Fixed(3)}" == "Fixed(3)")
    Local parts = Region(0, 0, 10, 1).SplitColumns(Constraint.Min(2), Constraint.Fill(3))
    Expect(parts[0].Width + parts[1].Width == 10)

    std/term/region.fb, line 121

    • Public ReadOnly Field Kind: ConstraintKind field #

      What kind of constraint it is.

    • Public ReadOnly Field Value: Int field #

      Its cells, percent, or weight, as its Kind has it.

    • @PanicsAtCaller Public Static Method Fixed(size: Int): Constraint static method #

      size cells. Panics for a negative size.

    • @PanicsAtCaller Public Static Method Percent(percent: Int): Constraint static method #

      percent of the cells there are, rounded down. Panics for a percent below 0 or past 100.

    • @PanicsAtCaller Public Static Method Min(size: Int): Constraint static method #

      At least size cells, and a share of what's left, as a Fill of 1. Panics for a negative size.

    • @PanicsAtCaller Public Static Method Fill(weight: Int = 1): Constraint static method #

      A share of what's left, by weight beside the other Fills' weights: a Fill of 2 gets twice a Fill of 1's. Panics for a negative weight.

    • Public Method ToString(): String method #

      Like "Fixed(3)" or "Fill(1)".

    Report an issue with this page or with FutureBlitz on GitHub.