anyhow

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

README

anyhow

go impl for https://docs.rs/anyhow/latest/anyhow/

codecov go report card test status Apache-2.0 license Go.Dev reference Go project version

Installation

go get github.com/chyroc/anyhow

Features

  • result struct
    • Result1[T]
    • Result2[T1, T2]
    • Result3[T1, T2, T3]
    • Result4[T1, T2, T3, T4]
    • Result5[T1, T2, T3, T4, T5]
    • Result6[T1, T2, T3, T4, T5, T6]
  • functions:
    • And(self R[T], res R[U]) R[U]: Returns res if the result is Ok, otherwise returns the Err value of self
    • AndThen(self R[T], op (T) -> R[U]) R[U]: Calls op if the result is Ok, otherwise returns the Err value of self
    • Map(self R[T], op (T) -> U) R[U]: Maps a Result to Result by applying a function to a contained Ok value, leaving an Err value untouched
    • MapOr(self R[T], default U, op func(T) U) U: Returns the provided default (if Err), or applies a function to the contained value (if Ok)
  • methods:
    • (R[T]) IntoErr() error: Returns the contained Err value, but never panics
    • (R[T]) IntoOk() T1: Returns the contained Ok value, but never panics
    • (R[T]) Expect(string) T: Returns the contained Ok value, otherwise panics with a panic message including the passed message, and the content of the Err
    • (R[T]) ExpectErr(string) error: Returns the contained Err value, otherwise panics with a panic message including the passed message, and the content of the Ok
    • (R[T]) Inspect(f (T) -> void) R[T]: Calls a function with a reference to the contained value if Ok
    • (R[T]) InspectErr(f (error) -> void) R[T]: Calls a function with a reference to the contained value if Err
    • (R[T]) MapErr(op func(error) error) R[T]: Maps a R[T] to R[T] by applying a function to a contained Err value, leaving an Ok value untouched
    • (R[T]) IsErr() bool: Returns true if the result is Err
    • (R[T]) IsOk() bool: Returns true if the result is Ok
    • (R[T]) Or(res R[T]) R[T]: Returns res if the result is Err, otherwise returns the Ok value of self
    • (R[T]) OrElse(op (error) -> R[T]) R[T]: Calls op if the result is Err, otherwise returns the Ok value of self
    • (R[T]) Unwrap() T: Returns the contained Ok value, otherwise panics with Err
    • (R[T]) UnwrapOr(default T) T: Returns the contained Ok value or a provided default
    • (R[T]) UnwrapOrDefault() T: Returns the contained Ok value or a default value
    • (R[T]) UnwrapOrElse(op (error) -> T) T: Returns the contained Ok value or computes it from a closure

Usage

package main

import (
  "log"
  "os/user"

  . "github.com/chyroc/anyhow"
)

func getHomePath() Result1[string] {
  user, err := user.Current()
  if err != nil {
    return Err1[string](err)
  }
  return Ok1(user.HomeDir)
}

func Example_AndThen_UnwrapOr() {
  // get home path, and then get log path, or use /tmp/log
  _ = AndThen11(getHomePath(), func(t1 string) Result1[string] {
    return Ok1(t1 + "/.log")
  }).UnwrapOr("/tmp/log")
}

func Example_Inspect_InspectErr() {
  // get home path, log it, or log error
  _ = getHomePath().Inspect(func(t1 string) {
    log.Println("home:", t1)
  }).InspectErr(func(err error) {
    log.Println("error:", err)
  }).UnwrapOr("/tmp/log")
}

func Example_Expect_ExpectErr() {
  // get home path, or panic with `must get home` msg
  _ = getHomePath().Expect("must get home")

  // get home path with err, or panic with `must get err` msg
  _ = getHomePath().ExpectErr("must get err")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result1 added in v0.1.1

type Result1[T1 any] struct {
	// contains filtered or unexported fields
}

Result1 ...

func And11 added in v0.2.0

func And11[T1, U1 any](self Result1[T1], res Result1[U1]) Result1[U1]

And11 Returns res if the result is Ok, otherwise returns the Err value of self

func And21 added in v0.2.0

func And21[T1, T2, U1 any](self Result2[T1, T2], res Result1[U1]) Result1[U1]

And21 Returns res if the result is Ok, otherwise returns the Err value of self

func And31 added in v0.2.0

func And31[T1, T2, T3, U1 any](self Result3[T1, T2, T3], res Result1[U1]) Result1[U1]

And31 Returns res if the result is Ok, otherwise returns the Err value of self

func And41 added in v0.2.0

func And41[T1, T2, T3, T4, U1 any](self Result4[T1, T2, T3, T4], res Result1[U1]) Result1[U1]

And41 Returns res if the result is Ok, otherwise returns the Err value of self

func And51 added in v0.2.0

func And51[T1, T2, T3, T4, T5, U1 any](self Result5[T1, T2, T3, T4, T5], res Result1[U1]) Result1[U1]

And51 Returns res if the result is Ok, otherwise returns the Err value of self

func And61 added in v0.2.0

func And61[T1, T2, T3, T4, T5, T6, U1 any](self Result6[T1, T2, T3, T4, T5, T6], res Result1[U1]) Result1[U1]

And61 Returns res if the result is Ok, otherwise returns the Err value of self

func AndThen11 added in v0.2.0

func AndThen11[T1, U1 any](self Result1[T1], op func(T1) Result1[U1]) Result1[U1]

AndThen11 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen21 added in v0.2.0

func AndThen21[T1, T2, U1 any](self Result2[T1, T2], op func(T1, T2) Result1[U1]) Result1[U1]

AndThen21 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen31 added in v0.2.0

func AndThen31[T1, T2, T3, U1 any](self Result3[T1, T2, T3], op func(T1, T2, T3) Result1[U1]) Result1[U1]

AndThen31 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen41 added in v0.2.0

func AndThen41[T1, T2, T3, T4, U1 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) Result1[U1]) Result1[U1]

AndThen41 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen51 added in v0.2.0

func AndThen51[T1, T2, T3, T4, T5, U1 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) Result1[U1]) Result1[U1]

AndThen51 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen61 added in v0.2.0

func AndThen61[T1, T2, T3, T4, T5, T6, U1 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) Result1[U1]) Result1[U1]

AndThen61 Calls op if the result is Ok, otherwise returns the Err value of self

func Err1 added in v0.1.1

func Err1[T1 any](err error) Result1[T1]

Err1 pack err to Result1

func Map11 added in v0.2.0

func Map11[T1, U1 any](self Result1[T1], op func(T1) U1) Result1[U1]

Map11 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map21 added in v0.2.0

func Map21[T1, T2, U1 any](self Result2[T1, T2], op func(T1, T2) U1) Result1[U1]

Map21 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map31 added in v0.2.0

func Map31[T1, T2, T3, U1 any](self Result3[T1, T2, T3], op func(T1, T2, T3) U1) Result1[U1]

Map31 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map41 added in v0.2.0

func Map41[T1, T2, T3, T4, U1 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) U1) Result1[U1]

Map41 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map51 added in v0.2.0

func Map51[T1, T2, T3, T4, T5, U1 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) U1) Result1[U1]

Map51 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map61 added in v0.2.0

func Map61[T1, T2, T3, T4, T5, T6, U1 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) U1) Result1[U1]

Map61 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func MapOr11 added in v0.2.0

func MapOr11[T1, U1 any](self Result1[T1], defaultV1 U1, op func(T1) Result1[U1]) Result1[U1]

MapOr11 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr21 added in v0.2.0

func MapOr21[T1, T2, U1 any](self Result2[T1, T2], defaultV1 U1, op func(T1, T2) Result1[U1]) Result1[U1]

MapOr21 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr31 added in v0.2.0

func MapOr31[T1, T2, T3, U1 any](self Result3[T1, T2, T3], defaultV1 U1, op func(T1, T2, T3) Result1[U1]) Result1[U1]

MapOr31 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr41 added in v0.2.0

func MapOr41[T1, T2, T3, T4, U1 any](self Result4[T1, T2, T3, T4], defaultV1 U1, op func(T1, T2, T3, T4) Result1[U1]) Result1[U1]

MapOr41 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr51 added in v0.2.0

func MapOr51[T1, T2, T3, T4, T5, U1 any](self Result5[T1, T2, T3, T4, T5], defaultV1 U1, op func(T1, T2, T3, T4, T5) Result1[U1]) Result1[U1]

MapOr51 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr61 added in v0.2.0

func MapOr61[T1, T2, T3, T4, T5, T6, U1 any](self Result6[T1, T2, T3, T4, T5, T6], defaultV1 U1, op func(T1, T2, T3, T4, T5, T6) Result1[U1]) Result1[U1]

MapOr61 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func Of1 added in v0.1.2

func Of1[T1 any](v1 T1, err error) Result1[T1]

Of1 pack v1, v2, ..., err to Result1

func Ok1 added in v0.1.1

func Ok1[T1 any](v1 T1) Result1[T1]

Ok1 pack v1, v2, ... to Result1

func (Result1[T1]) Expect added in v0.2.0

func (r Result1[T1]) Expect(msg string) T1

Expect Returns the contained Ok value, otherwise panics with a panic message including the passed message, and the content of the Err

func (Result1[T1]) ExpectErr added in v0.2.0

func (r Result1[T1]) ExpectErr(msg string) error

ExpectErr Returns the contained Err value, otherwise panics with a panic message including the passed message, and the content of the Ok

func (Result1[T1]) Inspect added in v0.2.0

func (r Result1[T1]) Inspect(f func(T1)) Result1[T1]

Inspect calls a function with a reference to the contained value if Ok

func (Result1[T1]) InspectErr added in v0.2.0

func (r Result1[T1]) InspectErr(f func(error)) Result1[T1]

InspectErr calls a function with a reference to the contained value if Err

func (Result1[T1]) IntoErr added in v0.2.0

func (r Result1[T1]) IntoErr() error

IntoErr Returns the contained Err value, but never panics

func (Result1[T1]) IntoOk added in v0.2.0

func (r Result1[T1]) IntoOk() T1

IntoOk Returns the contained Ok value, but never panics

func (Result1[T1]) IsErr added in v0.1.1

func (r Result1[T1]) IsErr() bool

IsErr returns true if the result is Err

func (Result1[T1]) IsOk added in v0.1.1

func (r Result1[T1]) IsOk() bool

IsOk returns true if the result is Ok

func (Result1[T1]) MapErr added in v0.2.0

func (r Result1[T1]) MapErr(op func(error) error) Result1[T1]

MapErr Maps a R[T] to R[T] by applying a function to a contained Err value, leaving an Ok value untouched

func (Result1[T1]) Or added in v0.2.0

func (r Result1[T1]) Or(res Result1[T1]) Result1[T1]

Or Returns res if the result is Err, otherwise returns the Ok value of self

func (Result1[T1]) OrElse added in v0.2.0

func (r Result1[T1]) OrElse(op func(error) Result1[T1]) Result1[T1]

OrElse Calls op if the result is Err, otherwise returns the Ok value of self

func (Result1[T1]) Unpack added in v0.1.1

func (r Result1[T1]) Unpack() (T1, error)

Unpack return (v1, v2, ..., err)

func (Result1[T1]) Unwrap added in v0.1.1

func (r Result1[T1]) Unwrap() T1

Unwrap Returns the contained Ok value, otherwise panics with Err

func (Result1[T1]) UnwrapOr added in v0.1.3

func (r Result1[T1]) UnwrapOr(v1 T1) T1

UnwrapOr Returns the contained Ok value or a provided default

func (Result1[T1]) UnwrapOrDefault added in v0.2.0

func (r Result1[T1]) UnwrapOrDefault() T1

UnwrapOrDefault Returns the contained Ok value or a default value

func (Result1[T1]) UnwrapOrElse added in v0.2.0

func (r Result1[T1]) UnwrapOrElse(op func(error) T1) T1

UnwrapOrElse Returns the contained Ok value or computes it from a closure

func (Result1[T1]) V1 added in v0.1.1

func (r Result1[T1]) V1() T1

type Result2 added in v0.1.1

type Result2[T1, T2 any] struct {
	// contains filtered or unexported fields
}

Result2 ...

func And12 added in v0.2.0

func And12[T1, U1, U2 any](self Result1[T1], res Result2[U1, U2]) Result2[U1, U2]

And12 Returns res if the result is Ok, otherwise returns the Err value of self

func And22 added in v0.2.0

func And22[T1, T2, U1, U2 any](self Result2[T1, T2], res Result2[U1, U2]) Result2[U1, U2]

And22 Returns res if the result is Ok, otherwise returns the Err value of self

func And32 added in v0.2.0

func And32[T1, T2, T3, U1, U2 any](self Result3[T1, T2, T3], res Result2[U1, U2]) Result2[U1, U2]

And32 Returns res if the result is Ok, otherwise returns the Err value of self

func And42 added in v0.2.0

func And42[T1, T2, T3, T4, U1, U2 any](self Result4[T1, T2, T3, T4], res Result2[U1, U2]) Result2[U1, U2]

And42 Returns res if the result is Ok, otherwise returns the Err value of self

func And52 added in v0.2.0

func And52[T1, T2, T3, T4, T5, U1, U2 any](self Result5[T1, T2, T3, T4, T5], res Result2[U1, U2]) Result2[U1, U2]

And52 Returns res if the result is Ok, otherwise returns the Err value of self

func And62 added in v0.2.0

func And62[T1, T2, T3, T4, T5, T6, U1, U2 any](self Result6[T1, T2, T3, T4, T5, T6], res Result2[U1, U2]) Result2[U1, U2]

And62 Returns res if the result is Ok, otherwise returns the Err value of self

func AndThen12 added in v0.2.0

func AndThen12[T1, U1, U2 any](self Result1[T1], op func(T1) Result2[U1, U2]) Result2[U1, U2]

AndThen12 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen22 added in v0.2.0

func AndThen22[T1, T2, U1, U2 any](self Result2[T1, T2], op func(T1, T2) Result2[U1, U2]) Result2[U1, U2]

AndThen22 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen32 added in v0.2.0

func AndThen32[T1, T2, T3, U1, U2 any](self Result3[T1, T2, T3], op func(T1, T2, T3) Result2[U1, U2]) Result2[U1, U2]

AndThen32 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen42 added in v0.2.0

func AndThen42[T1, T2, T3, T4, U1, U2 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) Result2[U1, U2]) Result2[U1, U2]

AndThen42 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen52 added in v0.2.0

func AndThen52[T1, T2, T3, T4, T5, U1, U2 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) Result2[U1, U2]) Result2[U1, U2]

AndThen52 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen62 added in v0.2.0

func AndThen62[T1, T2, T3, T4, T5, T6, U1, U2 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) Result2[U1, U2]) Result2[U1, U2]

AndThen62 Calls op if the result is Ok, otherwise returns the Err value of self

func Err2 added in v0.1.1

func Err2[T1, T2 any](err error) Result2[T1, T2]

Err2 pack err to Result2

func Map12 added in v0.2.0

func Map12[T1, U1, U2 any](self Result1[T1], op func(T1) (U1, U2)) Result2[U1, U2]

Map12 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map22 added in v0.2.0

func Map22[T1, T2, U1, U2 any](self Result2[T1, T2], op func(T1, T2) (U1, U2)) Result2[U1, U2]

Map22 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map32 added in v0.2.0

func Map32[T1, T2, T3, U1, U2 any](self Result3[T1, T2, T3], op func(T1, T2, T3) (U1, U2)) Result2[U1, U2]

Map32 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map42 added in v0.2.0

func Map42[T1, T2, T3, T4, U1, U2 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) (U1, U2)) Result2[U1, U2]

Map42 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map52 added in v0.2.0

func Map52[T1, T2, T3, T4, T5, U1, U2 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) (U1, U2)) Result2[U1, U2]

Map52 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map62 added in v0.2.0

func Map62[T1, T2, T3, T4, T5, T6, U1, U2 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) (U1, U2)) Result2[U1, U2]

Map62 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func MapOr12 added in v0.2.0

func MapOr12[T1, U1, U2 any](self Result1[T1], defaultV1 U1, defaultV2 U2, op func(T1) Result2[U1, U2]) Result2[U1, U2]

MapOr12 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr22 added in v0.2.0

func MapOr22[T1, T2, U1, U2 any](self Result2[T1, T2], defaultV1 U1, defaultV2 U2, op func(T1, T2) Result2[U1, U2]) Result2[U1, U2]

MapOr22 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr32 added in v0.2.0

func MapOr32[T1, T2, T3, U1, U2 any](self Result3[T1, T2, T3], defaultV1 U1, defaultV2 U2, op func(T1, T2, T3) Result2[U1, U2]) Result2[U1, U2]

MapOr32 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr42 added in v0.2.0

func MapOr42[T1, T2, T3, T4, U1, U2 any](self Result4[T1, T2, T3, T4], defaultV1 U1, defaultV2 U2, op func(T1, T2, T3, T4) Result2[U1, U2]) Result2[U1, U2]

MapOr42 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr52 added in v0.2.0

func MapOr52[T1, T2, T3, T4, T5, U1, U2 any](self Result5[T1, T2, T3, T4, T5], defaultV1 U1, defaultV2 U2, op func(T1, T2, T3, T4, T5) Result2[U1, U2]) Result2[U1, U2]

MapOr52 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr62 added in v0.2.0

func MapOr62[T1, T2, T3, T4, T5, T6, U1, U2 any](self Result6[T1, T2, T3, T4, T5, T6], defaultV1 U1, defaultV2 U2, op func(T1, T2, T3, T4, T5, T6) Result2[U1, U2]) Result2[U1, U2]

MapOr62 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func Of2 added in v0.1.2

func Of2[T1, T2 any](v1 T1, v2 T2, err error) Result2[T1, T2]

Of2 pack v1, v2, ..., err to Result2

func Ok2 added in v0.1.1

func Ok2[T1, T2 any](v1 T1, v2 T2) Result2[T1, T2]

Ok2 pack v1, v2, ... to Result2

func (Result2[T1, T2]) Expect added in v0.2.0

func (r Result2[T1, T2]) Expect(msg string) (T1, T2)

Expect Returns the contained Ok value, otherwise panics with a panic message including the passed message, and the content of the Err

func (Result2[T1, T2]) ExpectErr added in v0.2.0

func (r Result2[T1, T2]) ExpectErr(msg string) error

ExpectErr Returns the contained Err value, otherwise panics with a panic message including the passed message, and the content of the Ok

func (Result2[T1, T2]) Inspect added in v0.2.0

func (r Result2[T1, T2]) Inspect(f func(T1, T2)) Result2[T1, T2]

Inspect calls a function with a reference to the contained value if Ok

func (Result2[T1, T2]) InspectErr added in v0.2.0

func (r Result2[T1, T2]) InspectErr(f func(error)) Result2[T1, T2]

InspectErr calls a function with a reference to the contained value if Err

func (Result2[T1, T2]) IntoErr added in v0.2.0

func (r Result2[T1, T2]) IntoErr() error

IntoErr Returns the contained Err value, but never panics

func (Result2[T1, T2]) IntoOk added in v0.2.0

func (r Result2[T1, T2]) IntoOk() (T1, T2)

IntoOk Returns the contained Ok value, but never panics

func (Result2[T1, T2]) IsErr added in v0.1.1

func (r Result2[T1, T2]) IsErr() bool

IsErr returns true if the result is Err

func (Result2[T1, T2]) IsOk added in v0.1.1

func (r Result2[T1, T2]) IsOk() bool

IsOk returns true if the result is Ok

func (Result2[T1, T2]) MapErr added in v0.2.0

func (r Result2[T1, T2]) MapErr(op func(error) error) Result2[T1, T2]

MapErr Maps a R[T] to R[T] by applying a function to a contained Err value, leaving an Ok value untouched

func (Result2[T1, T2]) Or added in v0.2.0

func (r Result2[T1, T2]) Or(res Result2[T1, T2]) Result2[T1, T2]

Or Returns res if the result is Err, otherwise returns the Ok value of self

func (Result2[T1, T2]) OrElse added in v0.2.0

func (r Result2[T1, T2]) OrElse(op func(error) Result2[T1, T2]) Result2[T1, T2]

OrElse Calls op if the result is Err, otherwise returns the Ok value of self

func (Result2[T1, T2]) Unpack added in v0.1.1

func (r Result2[T1, T2]) Unpack() (T1, T2, error)

Unpack return (v1, v2, ..., err)

func (Result2[T1, T2]) Unwrap added in v0.1.1

func (r Result2[T1, T2]) Unwrap() (T1, T2)

Unwrap Returns the contained Ok value, otherwise panics with Err

func (Result2[T1, T2]) UnwrapOr added in v0.1.3

func (r Result2[T1, T2]) UnwrapOr(v1 T1, v2 T2) (T1, T2)

UnwrapOr Returns the contained Ok value or a provided default

func (Result2[T1, T2]) UnwrapOrDefault added in v0.2.0

func (r Result2[T1, T2]) UnwrapOrDefault() (T1, T2)

UnwrapOrDefault Returns the contained Ok value or a default value

func (Result2[T1, T2]) UnwrapOrElse added in v0.2.0

func (r Result2[T1, T2]) UnwrapOrElse(op func(error) (T1, T2)) (T1, T2)

UnwrapOrElse Returns the contained Ok value or computes it from a closure

func (Result2[T1, T2]) V1 added in v0.1.1

func (r Result2[T1, T2]) V1() T1

func (Result2[T1, T2]) V2 added in v0.1.1

func (r Result2[T1, T2]) V2() T2

type Result3 added in v0.1.1

type Result3[T1, T2, T3 any] struct {
	// contains filtered or unexported fields
}

Result3 ...

func And13 added in v0.2.0

func And13[T1, U1, U2, U3 any](self Result1[T1], res Result3[U1, U2, U3]) Result3[U1, U2, U3]

And13 Returns res if the result is Ok, otherwise returns the Err value of self

func And23 added in v0.2.0

func And23[T1, T2, U1, U2, U3 any](self Result2[T1, T2], res Result3[U1, U2, U3]) Result3[U1, U2, U3]

And23 Returns res if the result is Ok, otherwise returns the Err value of self

func And33 added in v0.2.0

func And33[T1, T2, T3, U1, U2, U3 any](self Result3[T1, T2, T3], res Result3[U1, U2, U3]) Result3[U1, U2, U3]

And33 Returns res if the result is Ok, otherwise returns the Err value of self

func And43 added in v0.2.0

func And43[T1, T2, T3, T4, U1, U2, U3 any](self Result4[T1, T2, T3, T4], res Result3[U1, U2, U3]) Result3[U1, U2, U3]

And43 Returns res if the result is Ok, otherwise returns the Err value of self

func And53 added in v0.2.0

func And53[T1, T2, T3, T4, T5, U1, U2, U3 any](self Result5[T1, T2, T3, T4, T5], res Result3[U1, U2, U3]) Result3[U1, U2, U3]

And53 Returns res if the result is Ok, otherwise returns the Err value of self

func And63 added in v0.2.0

func And63[T1, T2, T3, T4, T5, T6, U1, U2, U3 any](self Result6[T1, T2, T3, T4, T5, T6], res Result3[U1, U2, U3]) Result3[U1, U2, U3]

And63 Returns res if the result is Ok, otherwise returns the Err value of self

func AndThen13 added in v0.2.0

func AndThen13[T1, U1, U2, U3 any](self Result1[T1], op func(T1) Result3[U1, U2, U3]) Result3[U1, U2, U3]

AndThen13 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen23 added in v0.2.0

func AndThen23[T1, T2, U1, U2, U3 any](self Result2[T1, T2], op func(T1, T2) Result3[U1, U2, U3]) Result3[U1, U2, U3]

AndThen23 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen33 added in v0.2.0

func AndThen33[T1, T2, T3, U1, U2, U3 any](self Result3[T1, T2, T3], op func(T1, T2, T3) Result3[U1, U2, U3]) Result3[U1, U2, U3]

AndThen33 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen43 added in v0.2.0

func AndThen43[T1, T2, T3, T4, U1, U2, U3 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) Result3[U1, U2, U3]) Result3[U1, U2, U3]

AndThen43 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen53 added in v0.2.0

func AndThen53[T1, T2, T3, T4, T5, U1, U2, U3 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) Result3[U1, U2, U3]) Result3[U1, U2, U3]

AndThen53 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen63 added in v0.2.0

func AndThen63[T1, T2, T3, T4, T5, T6, U1, U2, U3 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) Result3[U1, U2, U3]) Result3[U1, U2, U3]

AndThen63 Calls op if the result is Ok, otherwise returns the Err value of self

func Err3 added in v0.1.1

func Err3[T1, T2, T3 any](err error) Result3[T1, T2, T3]

Err3 pack err to Result3

func Map13 added in v0.2.0

func Map13[T1, U1, U2, U3 any](self Result1[T1], op func(T1) (U1, U2, U3)) Result3[U1, U2, U3]

Map13 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map23 added in v0.2.0

func Map23[T1, T2, U1, U2, U3 any](self Result2[T1, T2], op func(T1, T2) (U1, U2, U3)) Result3[U1, U2, U3]

Map23 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map33 added in v0.2.0

func Map33[T1, T2, T3, U1, U2, U3 any](self Result3[T1, T2, T3], op func(T1, T2, T3) (U1, U2, U3)) Result3[U1, U2, U3]

Map33 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map43 added in v0.2.0

func Map43[T1, T2, T3, T4, U1, U2, U3 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) (U1, U2, U3)) Result3[U1, U2, U3]

Map43 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map53 added in v0.2.0

func Map53[T1, T2, T3, T4, T5, U1, U2, U3 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) (U1, U2, U3)) Result3[U1, U2, U3]

Map53 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map63 added in v0.2.0

func Map63[T1, T2, T3, T4, T5, T6, U1, U2, U3 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) (U1, U2, U3)) Result3[U1, U2, U3]

Map63 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func MapOr13 added in v0.2.0

func MapOr13[T1, U1, U2, U3 any](self Result1[T1], defaultV1 U1, defaultV2 U2, defaultV3 U3, op func(T1) Result3[U1, U2, U3]) Result3[U1, U2, U3]

MapOr13 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr23 added in v0.2.0

func MapOr23[T1, T2, U1, U2, U3 any](self Result2[T1, T2], defaultV1 U1, defaultV2 U2, defaultV3 U3, op func(T1, T2) Result3[U1, U2, U3]) Result3[U1, U2, U3]

MapOr23 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr33 added in v0.2.0

func MapOr33[T1, T2, T3, U1, U2, U3 any](self Result3[T1, T2, T3], defaultV1 U1, defaultV2 U2, defaultV3 U3, op func(T1, T2, T3) Result3[U1, U2, U3]) Result3[U1, U2, U3]

MapOr33 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr43 added in v0.2.0

func MapOr43[T1, T2, T3, T4, U1, U2, U3 any](self Result4[T1, T2, T3, T4], defaultV1 U1, defaultV2 U2, defaultV3 U3, op func(T1, T2, T3, T4) Result3[U1, U2, U3]) Result3[U1, U2, U3]

MapOr43 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr53 added in v0.2.0

func MapOr53[T1, T2, T3, T4, T5, U1, U2, U3 any](self Result5[T1, T2, T3, T4, T5], defaultV1 U1, defaultV2 U2, defaultV3 U3, op func(T1, T2, T3, T4, T5) Result3[U1, U2, U3]) Result3[U1, U2, U3]

MapOr53 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr63 added in v0.2.0

func MapOr63[T1, T2, T3, T4, T5, T6, U1, U2, U3 any](self Result6[T1, T2, T3, T4, T5, T6], defaultV1 U1, defaultV2 U2, defaultV3 U3, op func(T1, T2, T3, T4, T5, T6) Result3[U1, U2, U3]) Result3[U1, U2, U3]

MapOr63 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func Of3 added in v0.1.2

func Of3[T1, T2, T3 any](v1 T1, v2 T2, v3 T3, err error) Result3[T1, T2, T3]

Of3 pack v1, v2, ..., err to Result3

func Ok3 added in v0.1.1

func Ok3[T1, T2, T3 any](v1 T1, v2 T2, v3 T3) Result3[T1, T2, T3]

Ok3 pack v1, v2, ... to Result3

func (Result3[T1, T2, T3]) Expect added in v0.2.0

func (r Result3[T1, T2, T3]) Expect(msg string) (T1, T2, T3)

Expect Returns the contained Ok value, otherwise panics with a panic message including the passed message, and the content of the Err

func (Result3[T1, T2, T3]) ExpectErr added in v0.2.0

func (r Result3[T1, T2, T3]) ExpectErr(msg string) error

ExpectErr Returns the contained Err value, otherwise panics with a panic message including the passed message, and the content of the Ok

func (Result3[T1, T2, T3]) Inspect added in v0.2.0

func (r Result3[T1, T2, T3]) Inspect(f func(T1, T2, T3)) Result3[T1, T2, T3]

Inspect calls a function with a reference to the contained value if Ok

func (Result3[T1, T2, T3]) InspectErr added in v0.2.0

func (r Result3[T1, T2, T3]) InspectErr(f func(error)) Result3[T1, T2, T3]

InspectErr calls a function with a reference to the contained value if Err

func (Result3[T1, T2, T3]) IntoErr added in v0.2.0

func (r Result3[T1, T2, T3]) IntoErr() error

IntoErr Returns the contained Err value, but never panics

func (Result3[T1, T2, T3]) IntoOk added in v0.2.0

func (r Result3[T1, T2, T3]) IntoOk() (T1, T2, T3)

IntoOk Returns the contained Ok value, but never panics

func (Result3[T1, T2, T3]) IsErr added in v0.1.1

func (r Result3[T1, T2, T3]) IsErr() bool

IsErr returns true if the result is Err

func (Result3[T1, T2, T3]) IsOk added in v0.1.1

func (r Result3[T1, T2, T3]) IsOk() bool

IsOk returns true if the result is Ok

func (Result3[T1, T2, T3]) MapErr added in v0.2.0

func (r Result3[T1, T2, T3]) MapErr(op func(error) error) Result3[T1, T2, T3]

MapErr Maps a R[T] to R[T] by applying a function to a contained Err value, leaving an Ok value untouched

func (Result3[T1, T2, T3]) Or added in v0.2.0

func (r Result3[T1, T2, T3]) Or(res Result3[T1, T2, T3]) Result3[T1, T2, T3]

Or Returns res if the result is Err, otherwise returns the Ok value of self

func (Result3[T1, T2, T3]) OrElse added in v0.2.0

func (r Result3[T1, T2, T3]) OrElse(op func(error) Result3[T1, T2, T3]) Result3[T1, T2, T3]

OrElse Calls op if the result is Err, otherwise returns the Ok value of self

func (Result3[T1, T2, T3]) Unpack added in v0.1.1

func (r Result3[T1, T2, T3]) Unpack() (T1, T2, T3, error)

Unpack return (v1, v2, ..., err)

func (Result3[T1, T2, T3]) Unwrap added in v0.1.1

func (r Result3[T1, T2, T3]) Unwrap() (T1, T2, T3)

Unwrap Returns the contained Ok value, otherwise panics with Err

func (Result3[T1, T2, T3]) UnwrapOr added in v0.1.3

func (r Result3[T1, T2, T3]) UnwrapOr(v1 T1, v2 T2, v3 T3) (T1, T2, T3)

UnwrapOr Returns the contained Ok value or a provided default

func (Result3[T1, T2, T3]) UnwrapOrDefault added in v0.2.0

func (r Result3[T1, T2, T3]) UnwrapOrDefault() (T1, T2, T3)

UnwrapOrDefault Returns the contained Ok value or a default value

func (Result3[T1, T2, T3]) UnwrapOrElse added in v0.2.0

func (r Result3[T1, T2, T3]) UnwrapOrElse(op func(error) (T1, T2, T3)) (T1, T2, T3)

UnwrapOrElse Returns the contained Ok value or computes it from a closure

func (Result3[T1, T2, T3]) V1 added in v0.1.1

func (r Result3[T1, T2, T3]) V1() T1

func (Result3[T1, T2, T3]) V2 added in v0.1.1

func (r Result3[T1, T2, T3]) V2() T2

func (Result3[T1, T2, T3]) V3 added in v0.1.1

func (r Result3[T1, T2, T3]) V3() T3

type Result4 added in v0.1.1

type Result4[T1, T2, T3, T4 any] struct {
	// contains filtered or unexported fields
}

Result4 ...

func And14 added in v0.2.0

func And14[T1, U1, U2, U3, U4 any](self Result1[T1], res Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

And14 Returns res if the result is Ok, otherwise returns the Err value of self

func And24 added in v0.2.0

func And24[T1, T2, U1, U2, U3, U4 any](self Result2[T1, T2], res Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

And24 Returns res if the result is Ok, otherwise returns the Err value of self

func And34 added in v0.2.0

func And34[T1, T2, T3, U1, U2, U3, U4 any](self Result3[T1, T2, T3], res Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

And34 Returns res if the result is Ok, otherwise returns the Err value of self

func And44 added in v0.2.0

func And44[T1, T2, T3, T4, U1, U2, U3, U4 any](self Result4[T1, T2, T3, T4], res Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

And44 Returns res if the result is Ok, otherwise returns the Err value of self

func And54 added in v0.2.0

func And54[T1, T2, T3, T4, T5, U1, U2, U3, U4 any](self Result5[T1, T2, T3, T4, T5], res Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

And54 Returns res if the result is Ok, otherwise returns the Err value of self

func And64 added in v0.2.0

func And64[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4 any](self Result6[T1, T2, T3, T4, T5, T6], res Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

And64 Returns res if the result is Ok, otherwise returns the Err value of self

func AndThen14 added in v0.2.0

func AndThen14[T1, U1, U2, U3, U4 any](self Result1[T1], op func(T1) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

AndThen14 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen24 added in v0.2.0

func AndThen24[T1, T2, U1, U2, U3, U4 any](self Result2[T1, T2], op func(T1, T2) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

AndThen24 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen34 added in v0.2.0

func AndThen34[T1, T2, T3, U1, U2, U3, U4 any](self Result3[T1, T2, T3], op func(T1, T2, T3) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

AndThen34 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen44 added in v0.2.0

func AndThen44[T1, T2, T3, T4, U1, U2, U3, U4 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

AndThen44 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen54 added in v0.2.0

func AndThen54[T1, T2, T3, T4, T5, U1, U2, U3, U4 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

AndThen54 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen64 added in v0.2.0

func AndThen64[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

AndThen64 Calls op if the result is Ok, otherwise returns the Err value of self

func Err4 added in v0.1.1

func Err4[T1, T2, T3, T4 any](err error) Result4[T1, T2, T3, T4]

Err4 pack err to Result4

func Map14 added in v0.2.0

func Map14[T1, U1, U2, U3, U4 any](self Result1[T1], op func(T1) (U1, U2, U3, U4)) Result4[U1, U2, U3, U4]

Map14 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map24 added in v0.2.0

func Map24[T1, T2, U1, U2, U3, U4 any](self Result2[T1, T2], op func(T1, T2) (U1, U2, U3, U4)) Result4[U1, U2, U3, U4]

Map24 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map34 added in v0.2.0

func Map34[T1, T2, T3, U1, U2, U3, U4 any](self Result3[T1, T2, T3], op func(T1, T2, T3) (U1, U2, U3, U4)) Result4[U1, U2, U3, U4]

Map34 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map44 added in v0.2.0

func Map44[T1, T2, T3, T4, U1, U2, U3, U4 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) (U1, U2, U3, U4)) Result4[U1, U2, U3, U4]

Map44 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map54 added in v0.2.0

func Map54[T1, T2, T3, T4, T5, U1, U2, U3, U4 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) (U1, U2, U3, U4)) Result4[U1, U2, U3, U4]

Map54 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map64 added in v0.2.0

func Map64[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) (U1, U2, U3, U4)) Result4[U1, U2, U3, U4]

Map64 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func MapOr14 added in v0.2.0

func MapOr14[T1, U1, U2, U3, U4 any](self Result1[T1], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, op func(T1) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

MapOr14 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr24 added in v0.2.0

func MapOr24[T1, T2, U1, U2, U3, U4 any](self Result2[T1, T2], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, op func(T1, T2) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

MapOr24 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr34 added in v0.2.0

func MapOr34[T1, T2, T3, U1, U2, U3, U4 any](self Result3[T1, T2, T3], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, op func(T1, T2, T3) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

MapOr34 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr44 added in v0.2.0

func MapOr44[T1, T2, T3, T4, U1, U2, U3, U4 any](self Result4[T1, T2, T3, T4], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, op func(T1, T2, T3, T4) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

MapOr44 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr54 added in v0.2.0

func MapOr54[T1, T2, T3, T4, T5, U1, U2, U3, U4 any](self Result5[T1, T2, T3, T4, T5], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, op func(T1, T2, T3, T4, T5) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

MapOr54 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr64 added in v0.2.0

func MapOr64[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4 any](self Result6[T1, T2, T3, T4, T5, T6], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, op func(T1, T2, T3, T4, T5, T6) Result4[U1, U2, U3, U4]) Result4[U1, U2, U3, U4]

MapOr64 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func Of4 added in v0.1.2

func Of4[T1, T2, T3, T4 any](v1 T1, v2 T2, v3 T3, v4 T4, err error) Result4[T1, T2, T3, T4]

Of4 pack v1, v2, ..., err to Result4

func Ok4 added in v0.1.1

func Ok4[T1, T2, T3, T4 any](v1 T1, v2 T2, v3 T3, v4 T4) Result4[T1, T2, T3, T4]

Ok4 pack v1, v2, ... to Result4

func (Result4[T1, T2, T3, T4]) Expect added in v0.2.0

func (r Result4[T1, T2, T3, T4]) Expect(msg string) (T1, T2, T3, T4)

Expect Returns the contained Ok value, otherwise panics with a panic message including the passed message, and the content of the Err

func (Result4[T1, T2, T3, T4]) ExpectErr added in v0.2.0

func (r Result4[T1, T2, T3, T4]) ExpectErr(msg string) error

ExpectErr Returns the contained Err value, otherwise panics with a panic message including the passed message, and the content of the Ok

func (Result4[T1, T2, T3, T4]) Inspect added in v0.2.0

func (r Result4[T1, T2, T3, T4]) Inspect(f func(T1, T2, T3, T4)) Result4[T1, T2, T3, T4]

Inspect calls a function with a reference to the contained value if Ok

func (Result4[T1, T2, T3, T4]) InspectErr added in v0.2.0

func (r Result4[T1, T2, T3, T4]) InspectErr(f func(error)) Result4[T1, T2, T3, T4]

InspectErr calls a function with a reference to the contained value if Err

func (Result4[T1, T2, T3, T4]) IntoErr added in v0.2.0

func (r Result4[T1, T2, T3, T4]) IntoErr() error

IntoErr Returns the contained Err value, but never panics

func (Result4[T1, T2, T3, T4]) IntoOk added in v0.2.0

func (r Result4[T1, T2, T3, T4]) IntoOk() (T1, T2, T3, T4)

IntoOk Returns the contained Ok value, but never panics

func (Result4[T1, T2, T3, T4]) IsErr added in v0.1.1

func (r Result4[T1, T2, T3, T4]) IsErr() bool

IsErr returns true if the result is Err

func (Result4[T1, T2, T3, T4]) IsOk added in v0.1.1

func (r Result4[T1, T2, T3, T4]) IsOk() bool

IsOk returns true if the result is Ok

func (Result4[T1, T2, T3, T4]) MapErr added in v0.2.0

func (r Result4[T1, T2, T3, T4]) MapErr(op func(error) error) Result4[T1, T2, T3, T4]

MapErr Maps a R[T] to R[T] by applying a function to a contained Err value, leaving an Ok value untouched

func (Result4[T1, T2, T3, T4]) Or added in v0.2.0

func (r Result4[T1, T2, T3, T4]) Or(res Result4[T1, T2, T3, T4]) Result4[T1, T2, T3, T4]

Or Returns res if the result is Err, otherwise returns the Ok value of self

func (Result4[T1, T2, T3, T4]) OrElse added in v0.2.0

func (r Result4[T1, T2, T3, T4]) OrElse(op func(error) Result4[T1, T2, T3, T4]) Result4[T1, T2, T3, T4]

OrElse Calls op if the result is Err, otherwise returns the Ok value of self

func (Result4[T1, T2, T3, T4]) Unpack added in v0.1.1

func (r Result4[T1, T2, T3, T4]) Unpack() (T1, T2, T3, T4, error)

Unpack return (v1, v2, ..., err)

func (Result4[T1, T2, T3, T4]) Unwrap added in v0.1.1

func (r Result4[T1, T2, T3, T4]) Unwrap() (T1, T2, T3, T4)

Unwrap Returns the contained Ok value, otherwise panics with Err

func (Result4[T1, T2, T3, T4]) UnwrapOr added in v0.1.3

func (r Result4[T1, T2, T3, T4]) UnwrapOr(v1 T1, v2 T2, v3 T3, v4 T4) (T1, T2, T3, T4)

UnwrapOr Returns the contained Ok value or a provided default

func (Result4[T1, T2, T3, T4]) UnwrapOrDefault added in v0.2.0

func (r Result4[T1, T2, T3, T4]) UnwrapOrDefault() (T1, T2, T3, T4)

UnwrapOrDefault Returns the contained Ok value or a default value

func (Result4[T1, T2, T3, T4]) UnwrapOrElse added in v0.2.0

func (r Result4[T1, T2, T3, T4]) UnwrapOrElse(op func(error) (T1, T2, T3, T4)) (T1, T2, T3, T4)

UnwrapOrElse Returns the contained Ok value or computes it from a closure

func (Result4[T1, T2, T3, T4]) V1 added in v0.1.1

func (r Result4[T1, T2, T3, T4]) V1() T1

func (Result4[T1, T2, T3, T4]) V2 added in v0.1.1

func (r Result4[T1, T2, T3, T4]) V2() T2

func (Result4[T1, T2, T3, T4]) V3 added in v0.1.1

func (r Result4[T1, T2, T3, T4]) V3() T3

func (Result4[T1, T2, T3, T4]) V4 added in v0.1.1

func (r Result4[T1, T2, T3, T4]) V4() T4

type Result5 added in v0.1.1

type Result5[T1, T2, T3, T4, T5 any] struct {
	// contains filtered or unexported fields
}

Result5 ...

func And15 added in v0.2.0

func And15[T1, U1, U2, U3, U4, U5 any](self Result1[T1], res Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

And15 Returns res if the result is Ok, otherwise returns the Err value of self

func And25 added in v0.2.0

func And25[T1, T2, U1, U2, U3, U4, U5 any](self Result2[T1, T2], res Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

And25 Returns res if the result is Ok, otherwise returns the Err value of self

func And35 added in v0.2.0

func And35[T1, T2, T3, U1, U2, U3, U4, U5 any](self Result3[T1, T2, T3], res Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

And35 Returns res if the result is Ok, otherwise returns the Err value of self

func And45 added in v0.2.0

func And45[T1, T2, T3, T4, U1, U2, U3, U4, U5 any](self Result4[T1, T2, T3, T4], res Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

And45 Returns res if the result is Ok, otherwise returns the Err value of self

func And55 added in v0.2.0

func And55[T1, T2, T3, T4, T5, U1, U2, U3, U4, U5 any](self Result5[T1, T2, T3, T4, T5], res Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

And55 Returns res if the result is Ok, otherwise returns the Err value of self

func And65 added in v0.2.0

func And65[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4, U5 any](self Result6[T1, T2, T3, T4, T5, T6], res Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

And65 Returns res if the result is Ok, otherwise returns the Err value of self

func AndThen15 added in v0.2.0

func AndThen15[T1, U1, U2, U3, U4, U5 any](self Result1[T1], op func(T1) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

AndThen15 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen25 added in v0.2.0

func AndThen25[T1, T2, U1, U2, U3, U4, U5 any](self Result2[T1, T2], op func(T1, T2) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

AndThen25 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen35 added in v0.2.0

func AndThen35[T1, T2, T3, U1, U2, U3, U4, U5 any](self Result3[T1, T2, T3], op func(T1, T2, T3) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

AndThen35 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen45 added in v0.2.0

func AndThen45[T1, T2, T3, T4, U1, U2, U3, U4, U5 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

AndThen45 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen55 added in v0.2.0

func AndThen55[T1, T2, T3, T4, T5, U1, U2, U3, U4, U5 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

AndThen55 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen65 added in v0.2.0

func AndThen65[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4, U5 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

AndThen65 Calls op if the result is Ok, otherwise returns the Err value of self

func Err5 added in v0.1.1

func Err5[T1, T2, T3, T4, T5 any](err error) Result5[T1, T2, T3, T4, T5]

Err5 pack err to Result5

func Map15 added in v0.2.0

func Map15[T1, U1, U2, U3, U4, U5 any](self Result1[T1], op func(T1) (U1, U2, U3, U4, U5)) Result5[U1, U2, U3, U4, U5]

Map15 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map25 added in v0.2.0

func Map25[T1, T2, U1, U2, U3, U4, U5 any](self Result2[T1, T2], op func(T1, T2) (U1, U2, U3, U4, U5)) Result5[U1, U2, U3, U4, U5]

Map25 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map35 added in v0.2.0

func Map35[T1, T2, T3, U1, U2, U3, U4, U5 any](self Result3[T1, T2, T3], op func(T1, T2, T3) (U1, U2, U3, U4, U5)) Result5[U1, U2, U3, U4, U5]

Map35 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map45 added in v0.2.0

func Map45[T1, T2, T3, T4, U1, U2, U3, U4, U5 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) (U1, U2, U3, U4, U5)) Result5[U1, U2, U3, U4, U5]

Map45 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map55 added in v0.2.0

func Map55[T1, T2, T3, T4, T5, U1, U2, U3, U4, U5 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) (U1, U2, U3, U4, U5)) Result5[U1, U2, U3, U4, U5]

Map55 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map65 added in v0.2.0

func Map65[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4, U5 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) (U1, U2, U3, U4, U5)) Result5[U1, U2, U3, U4, U5]

Map65 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func MapOr15 added in v0.2.0

func MapOr15[T1, U1, U2, U3, U4, U5 any](self Result1[T1], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, op func(T1) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

MapOr15 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr25 added in v0.2.0

func MapOr25[T1, T2, U1, U2, U3, U4, U5 any](self Result2[T1, T2], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, op func(T1, T2) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

MapOr25 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr35 added in v0.2.0

func MapOr35[T1, T2, T3, U1, U2, U3, U4, U5 any](self Result3[T1, T2, T3], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, op func(T1, T2, T3) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

MapOr35 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr45 added in v0.2.0

func MapOr45[T1, T2, T3, T4, U1, U2, U3, U4, U5 any](self Result4[T1, T2, T3, T4], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, op func(T1, T2, T3, T4) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

MapOr45 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr55 added in v0.2.0

func MapOr55[T1, T2, T3, T4, T5, U1, U2, U3, U4, U5 any](self Result5[T1, T2, T3, T4, T5], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, op func(T1, T2, T3, T4, T5) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

MapOr55 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr65 added in v0.2.0

func MapOr65[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4, U5 any](self Result6[T1, T2, T3, T4, T5, T6], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, op func(T1, T2, T3, T4, T5, T6) Result5[U1, U2, U3, U4, U5]) Result5[U1, U2, U3, U4, U5]

MapOr65 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func Of5 added in v0.1.2

func Of5[T1, T2, T3, T4, T5 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, err error) Result5[T1, T2, T3, T4, T5]

Of5 pack v1, v2, ..., err to Result5

func Ok5 added in v0.1.1

func Ok5[T1, T2, T3, T4, T5 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5) Result5[T1, T2, T3, T4, T5]

Ok5 pack v1, v2, ... to Result5

func (Result5[T1, T2, T3, T4, T5]) Expect added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) Expect(msg string) (T1, T2, T3, T4, T5)

Expect Returns the contained Ok value, otherwise panics with a panic message including the passed message, and the content of the Err

func (Result5[T1, T2, T3, T4, T5]) ExpectErr added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) ExpectErr(msg string) error

ExpectErr Returns the contained Err value, otherwise panics with a panic message including the passed message, and the content of the Ok

func (Result5[T1, T2, T3, T4, T5]) Inspect added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) Inspect(f func(T1, T2, T3, T4, T5)) Result5[T1, T2, T3, T4, T5]

Inspect calls a function with a reference to the contained value if Ok

func (Result5[T1, T2, T3, T4, T5]) InspectErr added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) InspectErr(f func(error)) Result5[T1, T2, T3, T4, T5]

InspectErr calls a function with a reference to the contained value if Err

func (Result5[T1, T2, T3, T4, T5]) IntoErr added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) IntoErr() error

IntoErr Returns the contained Err value, but never panics

func (Result5[T1, T2, T3, T4, T5]) IntoOk added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) IntoOk() (T1, T2, T3, T4, T5)

IntoOk Returns the contained Ok value, but never panics

func (Result5[T1, T2, T3, T4, T5]) IsErr added in v0.1.1

func (r Result5[T1, T2, T3, T4, T5]) IsErr() bool

IsErr returns true if the result is Err

func (Result5[T1, T2, T3, T4, T5]) IsOk added in v0.1.1

func (r Result5[T1, T2, T3, T4, T5]) IsOk() bool

IsOk returns true if the result is Ok

func (Result5[T1, T2, T3, T4, T5]) MapErr added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) MapErr(op func(error) error) Result5[T1, T2, T3, T4, T5]

MapErr Maps a R[T] to R[T] by applying a function to a contained Err value, leaving an Ok value untouched

func (Result5[T1, T2, T3, T4, T5]) Or added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) Or(res Result5[T1, T2, T3, T4, T5]) Result5[T1, T2, T3, T4, T5]

Or Returns res if the result is Err, otherwise returns the Ok value of self

func (Result5[T1, T2, T3, T4, T5]) OrElse added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) OrElse(op func(error) Result5[T1, T2, T3, T4, T5]) Result5[T1, T2, T3, T4, T5]

OrElse Calls op if the result is Err, otherwise returns the Ok value of self

func (Result5[T1, T2, T3, T4, T5]) Unpack added in v0.1.1

func (r Result5[T1, T2, T3, T4, T5]) Unpack() (T1, T2, T3, T4, T5, error)

Unpack return (v1, v2, ..., err)

func (Result5[T1, T2, T3, T4, T5]) Unwrap added in v0.1.1

func (r Result5[T1, T2, T3, T4, T5]) Unwrap() (T1, T2, T3, T4, T5)

Unwrap Returns the contained Ok value, otherwise panics with Err

func (Result5[T1, T2, T3, T4, T5]) UnwrapOr added in v0.1.3

func (r Result5[T1, T2, T3, T4, T5]) UnwrapOr(v1 T1, v2 T2, v3 T3, v4 T4, v5 T5) (T1, T2, T3, T4, T5)

UnwrapOr Returns the contained Ok value or a provided default

func (Result5[T1, T2, T3, T4, T5]) UnwrapOrDefault added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) UnwrapOrDefault() (T1, T2, T3, T4, T5)

UnwrapOrDefault Returns the contained Ok value or a default value

func (Result5[T1, T2, T3, T4, T5]) UnwrapOrElse added in v0.2.0

func (r Result5[T1, T2, T3, T4, T5]) UnwrapOrElse(op func(error) (T1, T2, T3, T4, T5)) (T1, T2, T3, T4, T5)

UnwrapOrElse Returns the contained Ok value or computes it from a closure

func (Result5[T1, T2, T3, T4, T5]) V1 added in v0.1.1

func (r Result5[T1, T2, T3, T4, T5]) V1() T1

func (Result5[T1, T2, T3, T4, T5]) V2 added in v0.1.1

func (r Result5[T1, T2, T3, T4, T5]) V2() T2

func (Result5[T1, T2, T3, T4, T5]) V3 added in v0.1.1

func (r Result5[T1, T2, T3, T4, T5]) V3() T3

func (Result5[T1, T2, T3, T4, T5]) V4 added in v0.1.1

func (r Result5[T1, T2, T3, T4, T5]) V4() T4

func (Result5[T1, T2, T3, T4, T5]) V5 added in v0.1.1

func (r Result5[T1, T2, T3, T4, T5]) V5() T5

type Result6 added in v0.1.1

type Result6[T1, T2, T3, T4, T5, T6 any] struct {
	// contains filtered or unexported fields
}

Result6 ...

func And16 added in v0.2.0

func And16[T1, U1, U2, U3, U4, U5, U6 any](self Result1[T1], res Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

And16 Returns res if the result is Ok, otherwise returns the Err value of self

func And26 added in v0.2.0

func And26[T1, T2, U1, U2, U3, U4, U5, U6 any](self Result2[T1, T2], res Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

And26 Returns res if the result is Ok, otherwise returns the Err value of self

func And36 added in v0.2.0

func And36[T1, T2, T3, U1, U2, U3, U4, U5, U6 any](self Result3[T1, T2, T3], res Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

And36 Returns res if the result is Ok, otherwise returns the Err value of self

func And46 added in v0.2.0

func And46[T1, T2, T3, T4, U1, U2, U3, U4, U5, U6 any](self Result4[T1, T2, T3, T4], res Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

And46 Returns res if the result is Ok, otherwise returns the Err value of self

func And56 added in v0.2.0

func And56[T1, T2, T3, T4, T5, U1, U2, U3, U4, U5, U6 any](self Result5[T1, T2, T3, T4, T5], res Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

And56 Returns res if the result is Ok, otherwise returns the Err value of self

func And66 added in v0.2.0

func And66[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4, U5, U6 any](self Result6[T1, T2, T3, T4, T5, T6], res Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

And66 Returns res if the result is Ok, otherwise returns the Err value of self

func AndThen16 added in v0.2.0

func AndThen16[T1, U1, U2, U3, U4, U5, U6 any](self Result1[T1], op func(T1) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

AndThen16 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen26 added in v0.2.0

func AndThen26[T1, T2, U1, U2, U3, U4, U5, U6 any](self Result2[T1, T2], op func(T1, T2) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

AndThen26 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen36 added in v0.2.0

func AndThen36[T1, T2, T3, U1, U2, U3, U4, U5, U6 any](self Result3[T1, T2, T3], op func(T1, T2, T3) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

AndThen36 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen46 added in v0.2.0

func AndThen46[T1, T2, T3, T4, U1, U2, U3, U4, U5, U6 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

AndThen46 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen56 added in v0.2.0

func AndThen56[T1, T2, T3, T4, T5, U1, U2, U3, U4, U5, U6 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

AndThen56 Calls op if the result is Ok, otherwise returns the Err value of self

func AndThen66 added in v0.2.0

func AndThen66[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4, U5, U6 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

AndThen66 Calls op if the result is Ok, otherwise returns the Err value of self

func Err6 added in v0.1.1

func Err6[T1, T2, T3, T4, T5, T6 any](err error) Result6[T1, T2, T3, T4, T5, T6]

Err6 pack err to Result6

func Map16 added in v0.2.0

func Map16[T1, U1, U2, U3, U4, U5, U6 any](self Result1[T1], op func(T1) (U1, U2, U3, U4, U5, U6)) Result6[U1, U2, U3, U4, U5, U6]

Map16 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map26 added in v0.2.0

func Map26[T1, T2, U1, U2, U3, U4, U5, U6 any](self Result2[T1, T2], op func(T1, T2) (U1, U2, U3, U4, U5, U6)) Result6[U1, U2, U3, U4, U5, U6]

Map26 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map36 added in v0.2.0

func Map36[T1, T2, T3, U1, U2, U3, U4, U5, U6 any](self Result3[T1, T2, T3], op func(T1, T2, T3) (U1, U2, U3, U4, U5, U6)) Result6[U1, U2, U3, U4, U5, U6]

Map36 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map46 added in v0.2.0

func Map46[T1, T2, T3, T4, U1, U2, U3, U4, U5, U6 any](self Result4[T1, T2, T3, T4], op func(T1, T2, T3, T4) (U1, U2, U3, U4, U5, U6)) Result6[U1, U2, U3, U4, U5, U6]

Map46 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map56 added in v0.2.0

func Map56[T1, T2, T3, T4, T5, U1, U2, U3, U4, U5, U6 any](self Result5[T1, T2, T3, T4, T5], op func(T1, T2, T3, T4, T5) (U1, U2, U3, U4, U5, U6)) Result6[U1, U2, U3, U4, U5, U6]

Map56 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func Map66 added in v0.2.0

func Map66[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4, U5, U6 any](self Result6[T1, T2, T3, T4, T5, T6], op func(T1, T2, T3, T4, T5, T6) (U1, U2, U3, U4, U5, U6)) Result6[U1, U2, U3, U4, U5, U6]

Map66 Maps a Result<T> to Result<U> by applying a function to a contained Ok value, leaving an Err value untouched

func MapOr16 added in v0.2.0

func MapOr16[T1, U1, U2, U3, U4, U5, U6 any](self Result1[T1], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, defaultV6 U6, op func(T1) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

MapOr16 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr26 added in v0.2.0

func MapOr26[T1, T2, U1, U2, U3, U4, U5, U6 any](self Result2[T1, T2], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, defaultV6 U6, op func(T1, T2) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

MapOr26 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr36 added in v0.2.0

func MapOr36[T1, T2, T3, U1, U2, U3, U4, U5, U6 any](self Result3[T1, T2, T3], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, defaultV6 U6, op func(T1, T2, T3) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

MapOr36 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr46 added in v0.2.0

func MapOr46[T1, T2, T3, T4, U1, U2, U3, U4, U5, U6 any](self Result4[T1, T2, T3, T4], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, defaultV6 U6, op func(T1, T2, T3, T4) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

MapOr46 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr56 added in v0.2.0

func MapOr56[T1, T2, T3, T4, T5, U1, U2, U3, U4, U5, U6 any](self Result5[T1, T2, T3, T4, T5], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, defaultV6 U6, op func(T1, T2, T3, T4, T5) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

MapOr56 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func MapOr66 added in v0.2.0

func MapOr66[T1, T2, T3, T4, T5, T6, U1, U2, U3, U4, U5, U6 any](self Result6[T1, T2, T3, T4, T5, T6], defaultV1 U1, defaultV2 U2, defaultV3 U3, defaultV4 U4, defaultV5 U5, defaultV6 U6, op func(T1, T2, T3, T4, T5, T6) Result6[U1, U2, U3, U4, U5, U6]) Result6[U1, U2, U3, U4, U5, U6]

MapOr66 Returns the provided default (if Err), or applies a function to the contained value (if Ok)

func Of6 added in v0.1.2

func Of6[T1, T2, T3, T4, T5, T6 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6, err error) Result6[T1, T2, T3, T4, T5, T6]

Of6 pack v1, v2, ..., err to Result6

func Ok6 added in v0.1.1

func Ok6[T1, T2, T3, T4, T5, T6 any](v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6) Result6[T1, T2, T3, T4, T5, T6]

Ok6 pack v1, v2, ... to Result6

func (Result6[T1, T2, T3, T4, T5, T6]) Expect added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) Expect(msg string) (T1, T2, T3, T4, T5, T6)

Expect Returns the contained Ok value, otherwise panics with a panic message including the passed message, and the content of the Err

func (Result6[T1, T2, T3, T4, T5, T6]) ExpectErr added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) ExpectErr(msg string) error

ExpectErr Returns the contained Err value, otherwise panics with a panic message including the passed message, and the content of the Ok

func (Result6[T1, T2, T3, T4, T5, T6]) Inspect added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) Inspect(f func(T1, T2, T3, T4, T5, T6)) Result6[T1, T2, T3, T4, T5, T6]

Inspect calls a function with a reference to the contained value if Ok

func (Result6[T1, T2, T3, T4, T5, T6]) InspectErr added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) InspectErr(f func(error)) Result6[T1, T2, T3, T4, T5, T6]

InspectErr calls a function with a reference to the contained value if Err

func (Result6[T1, T2, T3, T4, T5, T6]) IntoErr added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) IntoErr() error

IntoErr Returns the contained Err value, but never panics

func (Result6[T1, T2, T3, T4, T5, T6]) IntoOk added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) IntoOk() (T1, T2, T3, T4, T5, T6)

IntoOk Returns the contained Ok value, but never panics

func (Result6[T1, T2, T3, T4, T5, T6]) IsErr added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) IsErr() bool

IsErr returns true if the result is Err

func (Result6[T1, T2, T3, T4, T5, T6]) IsOk added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) IsOk() bool

IsOk returns true if the result is Ok

func (Result6[T1, T2, T3, T4, T5, T6]) MapErr added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) MapErr(op func(error) error) Result6[T1, T2, T3, T4, T5, T6]

MapErr Maps a R[T] to R[T] by applying a function to a contained Err value, leaving an Ok value untouched

func (Result6[T1, T2, T3, T4, T5, T6]) Or added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) Or(res Result6[T1, T2, T3, T4, T5, T6]) Result6[T1, T2, T3, T4, T5, T6]

Or Returns res if the result is Err, otherwise returns the Ok value of self

func (Result6[T1, T2, T3, T4, T5, T6]) OrElse added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) OrElse(op func(error) Result6[T1, T2, T3, T4, T5, T6]) Result6[T1, T2, T3, T4, T5, T6]

OrElse Calls op if the result is Err, otherwise returns the Ok value of self

func (Result6[T1, T2, T3, T4, T5, T6]) Unpack added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) Unpack() (T1, T2, T3, T4, T5, T6, error)

Unpack return (v1, v2, ..., err)

func (Result6[T1, T2, T3, T4, T5, T6]) Unwrap added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) Unwrap() (T1, T2, T3, T4, T5, T6)

Unwrap Returns the contained Ok value, otherwise panics with Err

func (Result6[T1, T2, T3, T4, T5, T6]) UnwrapOr added in v0.1.3

func (r Result6[T1, T2, T3, T4, T5, T6]) UnwrapOr(v1 T1, v2 T2, v3 T3, v4 T4, v5 T5, v6 T6) (T1, T2, T3, T4, T5, T6)

UnwrapOr Returns the contained Ok value or a provided default

func (Result6[T1, T2, T3, T4, T5, T6]) UnwrapOrDefault added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) UnwrapOrDefault() (T1, T2, T3, T4, T5, T6)

UnwrapOrDefault Returns the contained Ok value or a default value

func (Result6[T1, T2, T3, T4, T5, T6]) UnwrapOrElse added in v0.2.0

func (r Result6[T1, T2, T3, T4, T5, T6]) UnwrapOrElse(op func(error) (T1, T2, T3, T4, T5, T6)) (T1, T2, T3, T4, T5, T6)

UnwrapOrElse Returns the contained Ok value or computes it from a closure

func (Result6[T1, T2, T3, T4, T5, T6]) V1 added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) V1() T1

func (Result6[T1, T2, T3, T4, T5, T6]) V2 added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) V2() T2

func (Result6[T1, T2, T3, T4, T5, T6]) V3 added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) V3() T3

func (Result6[T1, T2, T3, T4, T5, T6]) V4 added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) V4() T4

func (Result6[T1, T2, T3, T4, T5, T6]) V5 added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) V5() T5

func (Result6[T1, T2, T3, T4, T5, T6]) V6 added in v0.1.1

func (r Result6[T1, T2, T3, T4, T5, T6]) V6() T6

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL