Skip to main content

Scalar and utility types

Float​

Float is the type of coordinates, distances, and other solver expressions. A float literal has a decimal point, an exponent, or both: 12., -0.5, 1e-12, or 2.5e3.

Used by the geometry constructors, constraints, and instance positions.

warning

12 is an Int. Write 12. for a float.

Int​

Int is for counts, indices, point counts, and rotation angles. Schematic placement and routes are Int grid units, not Float.

Cast to a float with value as Float.

Bool​

Bool is true or false. Conditions must be booleans, and inst uses them for flags such as reflect and construction.

String​

String is text. Layer names and labels are strings.

std::layout::rect("met1");
std::layout::text("VDD", "text.label", 0., 0.);

Any​

Any erases a value's static type. It's occasionally useful for mixed or generic sequences, but concrete types give you field access and better error messages.

Unit ()​

() is the return type of functions that produce nothing useful, such as ones that only emit geometry or constraints.

fn align_left(a: Rect, b: Rect) -> () {
eq(a.x0, b.x0);
}