Use Property<LogicalLength> instead of Property<Coord>

This removes the special code for the generated property getters and
ensures type safety in the run-time library for property value setting.

In the Rust generated code we continue to do arithmetic on the scalar
values, that means we immediately extract the scalar, do arithmetic and
rely on the compiler to only allow compatible units.

Danger zone alert: In the interpreter Value::Number can now be converted
to LogicalLength as-is.
This commit is contained in:
Simon Hausmann 2022-10-13 16:35:00 +02:00 committed by Simon Hausmann
parent d505ac4809
commit c16253d29f
33 changed files with 496 additions and 380 deletions

View file

@ -205,6 +205,7 @@ fn gen_corelib(
"Coord",
"LogicalRect",
"LogicalPoint",
"LogicalLength",
]
.iter()
.chain(public_exported_types.iter())
@ -470,6 +471,7 @@ namespace slint {
struct Rect;
using LogicalRect = Rect;
using LogicalPoint = Point2D<float>;
using LogicalLength = float;
}
}",
)