Hide all Result fields

This commit is contained in:
Brandon Dyck 2024-09-11 11:09:16 -06:00
parent 570d7e32fc
commit bb1e77e8cd

View File

@ -11,16 +11,16 @@ import (
type Result[In, Out any] struct {
consumed, failed bool
Value Out
value Out
next State[In]
Message Message
message Message
}
func Fail[In, Out any](consumed bool, msg Message) Result[In, Out] {
return Result[In, Out]{
consumed: consumed,
failed: true,
Message: msg,
message: msg,
}
}
@ -28,7 +28,7 @@ func (r Result[In, Out]) Failed() (ok, consumed bool, msg Message) {
ok = r.failed
if ok {
consumed = r.consumed
msg = r.Message
msg = r.message
}
return
}
@ -36,10 +36,10 @@ func (r Result[In, Out]) Failed() (ok, consumed bool, msg Message) {
func Succeed[In, Out any](consumed bool, value Out, next State[In], msg Message) Result[In, Out] {
return Result[In, Out]{
failed: false,
Value: value,
value: value,
consumed: consumed,
next: next,
Message: msg,
message: msg,
}
}
@ -47,9 +47,9 @@ func (r Result[In, Out]) Succeeded() (ok, consumed bool, value Out, next State[I
ok = !r.failed
if ok {
consumed = r.consumed
value = r.Value
value = r.value
next = r.next
msg = r.Message
msg = r.message
}
return
}