Skip to content

Commit c58fb8b

Browse files
committed
Add more content to the README file
1 parent 778c499 commit c58fb8b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,34 @@ func printValues(a int, b string) {
5454
tup := tuple.New2(5, "hi!")
5555
a, b := tup.Values()
5656
```
57+
58+
## Formatting
59+
60+
Tuples implement the `Stringer` and `GoStringer` interfaces.
61+
62+
```go
63+
fmt.Println("%s", tuple.New2("hello", "world"))
64+
// Output:
65+
// ["hello" "world"]
66+
67+
fmt.Println("%#v", tuple.New2("hello", "world"))
68+
// Output:
69+
// tuple.T2[string, string]{V1: "hello", V2: "world"}
70+
```
71+
72+
# Notes
73+
74+
The tuples code and test code are generated by the `scripts/gen/main.go` script.
75+
76+
The generation works by reading `tuple.tpl` and `tuple_test.tpl` using Go's `text/template` engine.
77+
`tuple.tpl` and `tuple_test.tpl` detail the templated content of a generic tuple class, with variable number of elements.
78+
79+
# Contributing
80+
81+
Please feel free to contribute to this project by opening issues or creating pull-requests.
82+
However, keep in mind that generic type features for Go are still in their early stages, so there might
83+
not be support from the language to your requested feature.
84+
85+
Also keep in mind when contributing to keep the compilation time and performance of this package fast.
86+
87+
Feel free to contact me at [[email protected]](mailto:[email protected]) for questions or suggestions!

0 commit comments

Comments
 (0)