container

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintNode added in v0.2.3

func PrintNode[T comparable](node Node[T], options PrintOptions) string

PrintNode recursively prints node

Types

type Node added in v0.2.3

type Node[T comparable] interface {
	ToString() string        // ToString returns node self information
	Parent() T               // Parent returns parent node or nil
	NumChild() int           // NumChild returns number of child
	GetChildByIndex(i int) T // GetChildByIndex gets child by index
}

Node represents a generic printable node

type Pair added in v0.1.0

type Pair[T1, T2 any] struct {
	First  T1
	Second T2
}

Pair contains two values like c++ std::pair

func MakePair added in v0.1.0

func MakePair[T1, T2 any](first T1, second T2) Pair[T1, T2]

MakePair make a pair by values

type PrintOptions added in v0.2.3

type PrintOptions struct {
	Prefix         string
	IconParent     string // default "│  "
	IconSpace      string // default "   "
	IconBranch     string // default "├──"
	IconLastBranch string // default "└──"
}

PrintOptions represents a options for printing Node

func (*PrintOptions) Fix added in v0.2.3

func (options *PrintOptions) Fix()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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