From f7bd28118c4ac34a9a444073b31ca8f2579188f3 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 29 Jul 2025 03:06:49 +0900 Subject: hst: configurable wait delay This is useful for programs that take a long time to clean up. Signed-off-by: Ophestra --- internal/app/strings.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 internal/app/strings.go (limited to 'internal/app/strings.go') diff --git a/internal/app/strings.go b/internal/app/strings.go new file mode 100644 index 00000000..e4465cee --- /dev/null +++ b/internal/app/strings.go @@ -0,0 +1,19 @@ +package app + +import ( + "strconv" + + "hakurei.app/internal/app/state" +) + +func newInt(v int) *stringPair[int] { return &stringPair[int]{v, strconv.Itoa(v)} } +func newID(id *state.ID) *stringPair[state.ID] { return &stringPair[state.ID]{*id, id.String()} } + +// stringPair stores a value and its string representation. +type stringPair[T comparable] struct { + v T + s string +} + +func (s *stringPair[T]) unwrap() T { return s.v } +func (s *stringPair[T]) String() string { return s.s } -- cgit v1.3.1