diff options
Diffstat (limited to 'examples/30-generic-structs')
| -rw-r--r-- | examples/30-generic-structs/shed.toml | 7 | ||||
| -rw-r--r-- | examples/30-generic-structs/src/HelloWorld.shed | 15 |
2 files changed, 22 insertions, 0 deletions
diff --git a/examples/30-generic-structs/shed.toml b/examples/30-generic-structs/shed.toml new file mode 100644 index 00000000..bf5c13c4 --- /dev/null +++ b/examples/30-generic-structs/shed.toml @@ -0,0 +1,7 @@ +[[shed.bins]] +name = "hello-world" +main-namespace = "HelloWorld" + +[[shed.examples]] +bin = "hello-world" +expected-output = "hello, world" diff --git a/examples/30-generic-structs/src/HelloWorld.shed b/examples/30-generic-structs/src/HelloWorld.shed new file mode 100644 index 00000000..f5a2f013 --- /dev/null +++ b/examples/30-generic-structs/src/HelloWorld.shed @@ -0,0 +1,15 @@ +pub fun main() ! Io -> Unit { + val messageParts = getMessageParts(); + print!(messageParts.part1); + print!(messageParts.part2); +} + +struct Parts[T1, T2]( + .part1: T1, + .part2: T2, +) { +} + +fun getMessageParts() -> Parts[String, String] { + Parts[String, String](.part1 = "hello, ", .part2 = "world\n") +} |
