tools: golang.org/x/tools/internal/event/label Index | Files

package label

import "golang.org/x/tools/internal/event/label"

Index

Package Files

label.go

type Key Uses

type Key interface {
    // Name returns the key name.
    Name() string
    // Description returns a string that can be used to describe the value.
    Description() string

    // Format is used in formatting to append the value of the label to the
    // supplied buffer.
    // The formatter may use the supplied buf as a scratch area to avoid
    // allocations.
    Format(w io.Writer, buf []byte, l Label)
}

Key is used as the identity of a Label. Keys are intended to be compared by pointer only, the name should be unique for communicating with external systems, but it is not required or enforced.

type Label Uses

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

Label holds a key and value pair. It is normally used when passing around lists of labels.

func Of64 Uses

func Of64(k Key, v uint64) Label

Of64 creates a new label from a key and a uint64. This is often used for non uint64 values that can be packed into a uint64. This method is for implementing new key types, label creation should normally be done with the Of method of the key.

func OfString Uses

func OfString(k Key, v string) Label

OfString creates a new label from a key and a string. This method is for implementing new key types, label creation should normally be done with the Of method of the key.

func OfValue Uses

func OfValue(k Key, value interface{}) Label

OfValue creates a new label from the key and value. This method is for implementing new key types, label creation should normally be done with the Of method of the key.

func (Label) Format Uses

func (t Label) Format(f fmt.State, r rune)

Format is used for debug printing of labels.

func (Label) Key Uses

func (t Label) Key() Key

Key returns the key of this Label.

func (Label) Unpack64 Uses

func (t Label) Unpack64() uint64

Unpack64 assumes the label was built using LabelOf64 and returns the value that was passed to that constructor. This method is for implementing new key types, for type safety normal access should be done with the From method of the key.

func (Label) UnpackString Uses

func (t Label) UnpackString() string

UnpackString assumes the label was built using LabelOfString and returns the value that was passed to that constructor. This method is for implementing new key types, for type safety normal access should be done with the From method of the key.

func (Label) UnpackValue Uses

func (t Label) UnpackValue() interface{}

UnpackValue assumes the label was built using LabelOfValue and returns the value that was passed to that constructor. This method is for implementing new key types, for type safety normal access should be done with the From method of the key.

func (Label) Valid Uses

func (t Label) Valid() bool

Valid returns true if the Label is a valid one (it has a key).

type List Uses

type List interface {
    // Valid returns true if the index is within range for the list.
    // It does not imply the label at that index will itself be valid.
    Valid(index int) bool
    // Label returns the label at the given index.
    Label(index int) Label
}

List is the interface to something that provides an iterable list of labels. Iteration should start from 0 and continue until Valid returns false.

func Filter Uses

func Filter(l List, keys ...Key) List

func NewList Uses

func NewList(labels ...Label) List

type Map Uses

type Map interface {
    // Find returns the label that matches the supplied key.
    Find(key Key) Label
}

Map is the interface to a collection of Labels indexed by key.

func MergeMaps Uses

func MergeMaps(srcs ...Map) Map

func NewMap Uses

func NewMap(labels ...Label) Map

Package label imports 4 packages (graph) and is imported by 14 packages. Updated 2020-07-16. Refresh now. Tools for package owners.