tree

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	deadlock.RWMutex
	// contains filtered or unexported fields
}

func (Group) Binds

func (m Group) Binds() *bind.BindScope

func (*Group) ChildByName added in v0.2.0

func (g *Group) ChildByName(name string) (node Node, ok bool)

func (*Group) Children

func (g *Group) Children() []Node

func (Group) Id

func (m Group) Id() int32

func (*Group) Leaves added in v0.1.6

func (g *Group) Leaves() []Node

func (Group) Name

func (m Group) Name() string

func (*Group) NewGroup

func (g *Group) NewGroup() *Group

func (*Group) NewPane

func (g *Group) NewPane(ctx context.Context, screen mux.Screen) *Pane

func (*Group) NewPaneCreator added in v0.9.0

func (g *Group) NewPaneCreator(ctx context.Context) (NodeID, func(screen mux.Screen) *Pane)

NewPaneCreator is the same as NewPane, but it gives you the NodeID before the Node is created and a function to call with the final Screen.

func (Group) Params added in v0.1.6

func (m Group) Params() *params.Parameters

func (Group) Protected added in v0.2.0

func (m Group) Protected() bool

Protected reports whether or not this node is protected (or cannot be removed.)

func (Group) SetName

func (m Group) SetName(name string)

func (Group) SetProtected added in v0.2.0

func (m Group) SetProtected(value bool)

SetProtected sets whether or not this node can be removed.

type Node

type Node interface {
	Id() NodeID
	Name() string
	Params() *params.Parameters
	SetName(string)
	Protected() bool
	Binds() *bind.BindScope
}

type NodeEvent added in v0.1.6

type NodeEvent struct {
	Id    NodeID
	Event events.Msg
}

type NodeID

type NodeID = int32

type Pane

type Pane struct {
	util.Lifetime
	// contains filtered or unexported fields
}

func (Pane) Binds

func (m Pane) Binds() *bind.BindScope

func (Pane) Id

func (m Pane) Id() int32

func (Pane) Name

func (m Pane) Name() string

func (Pane) Params added in v0.1.6

func (m Pane) Params() *params.Parameters

func (Pane) Protected added in v0.2.0

func (m Pane) Protected() bool

Protected reports whether or not this node is protected (or cannot be removed.)

func (*Pane) Screen

func (p *Pane) Screen() mux.Screen

func (Pane) SetName

func (m Pane) SetName(name string)

func (Pane) SetProtected added in v0.2.0

func (m Pane) SetProtected(value bool)

SetProtected sets whether or not this node can be removed.

type Tree

type Tree struct {
	deadlock.RWMutex
	*mux.UpdatePublisher
	// contains filtered or unexported fields
}

func NewTree

func NewTree(options ...TreeOption) *Tree

func (*Tree) GroupById

func (t *Tree) GroupById(id NodeID) (*Group, bool)

func (*Tree) Leaves

func (t *Tree) Leaves() []Node

func (*Tree) NodeById

func (t *Tree) NodeById(id NodeID) (Node, bool)

func (*Tree) PaneById

func (t *Tree) PaneById(id NodeID) (*Pane, bool)

func (*Tree) PathTo

func (t *Tree) PathTo(node Node) []Node

Get the path from the root node to the given node.

func (*Tree) RemoveNode added in v0.1.1

func (t *Tree) RemoveNode(id NodeID) error

func (*Tree) Reset added in v0.2.0

func (t *Tree) Reset()

Reset safely clears the state of the tree. Only useful in testing.

func (*Tree) Root

func (t *Tree) Root() *Group

type TreeOption added in v0.1.6

type TreeOption func(*Tree)

func WithParams added in v0.1.6

func WithParams(p *params.Parameters) TreeOption

Jump to

Keyboard shortcuts

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