typed

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 3 Imported by: 1

README

set of typed data types

another copy of result data type
inspired by rust

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CaptureStackOnPanic = true

Functions

func RecoverIfPanic added in v1.0.4

func RecoverIfPanic[T any](resultReference *Result[T])

Types

type PanickedError added in v1.0.4

type PanickedError struct {
	Cause any
	Stack string
}

func (PanickedError) Error added in v1.0.4

func (pe PanickedError) Error() string

type Result

type Result[T any] struct {
	// contains filtered or unexported fields
}

func ResultFailed

func ResultFailed[T any](err error) Result[T]

func ResultOk

func ResultOk[T any](v T) Result[T]

func (Result[T]) Accept added in v1.0.6

func (opt Result[T]) Accept(f func(*T)) (nextResult Result[T])

func (Result[T]) Fail added in v1.0.3

func (opt Result[T]) Fail(f func(e error)) Result[T]

func (Result[T]) IsOk

func (opt Result[T]) IsOk() bool

func (*Result[T]) SetFail

func (opt *Result[T]) SetFail(v error) *Result[T]

func (*Result[T]) SetOk

func (opt *Result[T]) SetOk(v T) *Result[T]

func (Result[T]) String

func (r Result[T]) String() string

func (Result[T]) Then

func (opt Result[T]) Then(f func(*T) *Result[T]) Result[T]

func (Result[T]) Unwrap

func (opt Result[T]) Unwrap() T

func (Result[T]) UnwrapError

func (opt Result[T]) UnwrapError() error

func (Result[T]) UnwrapOrDefault added in v1.0.5

func (opt Result[T]) UnwrapOrDefault(def T) T

func (Result[T]) UnwrapOrPanic added in v1.0.6

func (opt Result[T]) UnwrapOrPanic(msg string) T

Jump to

Keyboard shortcuts

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