summaryrefslogtreecommitdiff
path: root/examples/03-struct-generic/src/point.hob
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-08-10 11:10:31 +0100
committerMichael Williamson <mike@zwobble.org>2026-08-10 17:24:21 +0100
commit4da9b7d377e397b1076a5f19cf7e38e734fefbd3 (patch)
tree917034e46412ade30c6deb41ee3cd915caf93095 /examples/03-struct-generic/src/point.hob
parent4b8dd80f18ae1e4bad0c61d55de685d69dfdbe1c (diff)
Generate builders for generic structs
Diffstat (limited to 'examples/03-struct-generic/src/point.hob')
-rw-r--r--examples/03-struct-generic/src/point.hob12
1 files changed, 11 insertions, 1 deletions
diff --git a/examples/03-struct-generic/src/point.hob b/examples/03-struct-generic/src/point.hob
index 3ed314a..f923785 100644
--- a/examples/03-struct-generic/src/point.hob
+++ b/examples/03-struct-generic/src/point.hob
@@ -1,3 +1,13 @@
+/// A 2D drawing made up of straight lines.
+struct LineDrawing2D {
+ field lines: Line[Point2D];
+}
+
+/// A drawing made up of straight lines.
+struct LineDrawing[TPoint] {
+ field lines: Line[TPoint];
+}
+
/// A straight line from one point to another.
struct Line[TPoint] {
field start: TPoint;
@@ -5,7 +15,7 @@ struct Line[TPoint] {
}
/// A 2D point.
-struct Point {
+struct Point2D {
field x: Int32;
field y: Int32;
}