fix(Type): only require pointers where nil is meaningful other than panicking on it

This commit is contained in:
2025-01-05 22:27:49 +01:00
parent 4855e19fb3
commit 5b240e0457
2 changed files with 4 additions and 8 deletions

View File

@@ -49,16 +49,14 @@ func (res *Result[T]) HasValue() bool {
}
// UNWRAPPABLE INTERFACE
func (res *Result[T]) Expect(msg string) T {
Assert.NotNil(res)
func (res Result[T]) Expect(msg string) T {
if res.err == nil {
return res.value
}
panic(msg)
}
func (res *Result[T]) Unwrap() T {
Assert.NotNil(res)
func (res Result[T]) Unwrap() T {
if res.err == nil {
return res.value
}