Renamed Result.Succeeded to Status and removed Failed

This commit is contained in:
2024-09-24 13:16:30 -06:00
parent f8bc7582a5
commit 9375b51a70
7 changed files with 114 additions and 113 deletions

View File

@ -19,10 +19,10 @@ func Bind{{.}}[In, Out{{range .Count}}, T{{.}}{{end}} any](
return Result[In, Out]{}, err
}
anyConsumed = anyConsumed || r{{.}}.Consumed()
if r{{.}}.Failed() {
success, val{{.}}, next := r{{.}}.Status()
if !success {
return Fail[In, Out](anyConsumed, r{{.}}.Message()), nil
}
_, val{{.}}, next := r{{.}}.Succeeded()
{{end}}
return Succeed(anyConsumed, val{{.Next}}, next, MessageOK(s.Pos())), nil
}

View File

@ -15,10 +15,10 @@ func Seq{{.}}[In, Out{{range .Count}}, T{{.}}{{end}} any](
return Result[In, Out]{}, err
}
anyConsumed = anyConsumed || r{{.}}.Consumed()
if r{{.}}.Failed() {
success, val{{.}}, next := r{{.}}.Status()
if !success {
return Fail[In, Out](anyConsumed, r{{.}}.Message()), nil
}
_, val{{.}}, next := r{{.}}.Succeeded()
{{end}}
final := f({{range .Count}}{{if ne . 1}}, {{end}}val{{.}}{{end}})
return Succeed(anyConsumed, final, next, MessageOK(s.Pos())), nil