internal

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = slog.Default()

Functions

func FuncName

func FuncName() string

FuncName returns the name of the function that calls this function. This is useful when you want to define a constructor for a custom node without having to explicitly set its name. Example:

func SomeNode( args ) core.Node[Blackboard]{
	name := util.FuncName() // will be "SomeNode"
	base := core.NewT(name) // T is Composite, Decorator or Leaf
	return &someNode{T: base}
}

func WaitForSignalOrTimeout

func WaitForSignalOrTimeout(sigChan <-chan bool, d time.Duration) (bool, error)

Wait until the provided signal is returned or the timeout is reached TODO: replace duration with a context closing

Types

type ErrorBuilder

type ErrorBuilder struct {
	// contains filtered or unexported fields
}

ErrorBuilder wraps github.com/pkg/errors and lets the user build an error through successive writes, each one wrapping the builder's error written error message.

func (*ErrorBuilder) Error

func (b *ErrorBuilder) Error() error

Error return the error builder's internal error.

func (*ErrorBuilder) SetMessage

func (b *ErrorBuilder) SetMessage(format string, args ...any)

SetMessage sets a string that will be prepended to all successive calls to Write.

func (*ErrorBuilder) String

func (b *ErrorBuilder) String() string

String returns the error builder's internal error string.

func (*ErrorBuilder) UnsetMessage

func (b *ErrorBuilder) UnsetMessage()

UnsetMessage resets the prepended string.

func (*ErrorBuilder) Write

func (b *ErrorBuilder) Write(format string, args ...any)

Write wraps the error builder's error with the arguments.

Jump to

Keyboard shortcuts

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