immutable

package
v0.0.0-...-4eea09c Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package immutable is a helper package for the immutable data structures generated by myitcv.io/immutable/cmd/immutableGen.

Index

Constants

View Source
const (
	CmdImmutableGen = "immutableGen"
	CmdImmutableVet = "immutableVet"
)
View Source
const (
	// ImmTypeTmplPrefix is the prefix used to identify immutable type templates
	ImmTypeTmplPrefix = "_Imm_"

	// Pkg is the import path of this package
	PkgImportPath = "myitcv.io/immutable"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Immutable

type Immutable interface {
	Mutable() bool
	IsDeeplyNonMutable(seen map[interface{}]bool) bool
}

Immutable is the interface implemented by all immutable types. If Go had generics the interface would be defined, assuming a generic type parameter T, as follows:

type Immutable<T> interface {
	AsMutable() T
	AsImmutable() T
	WithMutations(f func(v T)) T
	Mutable() bool
}

Because we do not have such a type parameter we can only define the Mutable() method in the interface

Directories

Path Synopsis
cmd
immutableGen
immutableGen is a go generate generator that creates immutable struct, map and slice type declarations from template type declarations.
immutableGen is a go generate generator that creates immutable struct, map and slice type declarations from template type declarations.

Jump to

Keyboard shortcuts

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