We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some sketching:
type Result[T any] struct { item *T err error } func Ok[T any](value T) Result[T] { return Result[T]{ item: &value, err: nil, } } func Err[T any](err error) Result[T] { return Result[T]{ item: nil, err: err, } } func getTemp(succeed bool) Result[string] { if succeed { return Ok("warm") } else { return Err[string](errors.New("could not succeed")) } } func main() { temp := getTemp(true) fmt.Printf("temp=%s\n", *temp.item) }
The text was updated successfully, but these errors were encountered:
See also: https://github.com/samber/mo
Sorry, something went wrong.
No branches or pull requests
Some sketching:
The text was updated successfully, but these errors were encountered: