hopp/option.go
sashakoshka@tebibyte.media 9c64274622 Add option type
TODO: when go 1.24 drops, turn it into a generic type alias
2025-01-21 16:20:40 -05:00

20 lines
421 B
Go

package hopp
import "git.tebibyte.media/sashakoshka/go-util/container"
// Option allows an optional value to be defined without using a pointer.
// TODO make generic alias once go 1.24 releases
type Option[T any] ucontainer.Optional[T]
func (option *Option[T]) Get() (T, bool) {
return option.Get()
}
func (option *Option[T]) Set(value T) {
option.Set(value)
}
func (option *Option[T]) Reset() {
option.Reset()
}