immutable

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 1 Imported by: 12

README

Immutable

A collection of core immutable types used across Source repositories

Documentation

Overview

Package immutable provides immutable types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

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

Option represents an item that may or may not have a value.

func None

func None[T any]() Option[T]

Some returns an `Option` of type `T` with no value.

func Some

func Some[T any](value T) Option[T]

Some returns an `Option` of type `T` with the given value.

func (Option[T]) HasValue

func (o Option[T]) HasValue() bool

HasValue returns a boolean indicating whether or not this option contains a value. If it returns true, this Option contains a value, if it is false it contains no value.

func (Option[T]) MarshalJSON added in v0.2.2

func (o Option[T]) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Option[T]) UnmarshalJSON added in v0.2.2

func (o *Option[T]) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (Option[T]) Value

func (o Option[T]) Value() T

Value returns the Value of this Option. Value returned is invalid HasValue() is false and should be ignored.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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