attr

package
v0.0.0-...-6166138 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package attr provides data structures for representing sets of keyed attributes.

This package is an implementation detail of the dep and version packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mask

type Mask uint8

A Mask is a bitmask of reserved, widely used, no-valued attributes whose presence in a Set is the indicator. All eight bits may be set; their semantics are defined by the user of this package.

type Set

type Set struct {
	// Mask is a bitmask that may be manipulated directly.
	// See the Mask type doc for details.
	Mask Mask
	// contains filtered or unexported fields
}

Set is a collection of attributes, represented as a Mask and a map of arbitrary uint8 keys to string values.

The zero value of Set is an empty, default set.

func (Set) Clone

func (s Set) Clone() Set

Clone returns a clone of the given Set.

func (Set) Compare

func (s Set) Compare(other Set) int

Compare returns -1, 0 or 1 depending on whether the Set is ordered before, equal to or after the other Set.

func (Set) ForEachAttr

func (s Set) ForEachAttr(f func(key uint8, value string))

ForEachAttr calls f for each attribute in ascending key order.

func (Set) GetAttr

func (s Set) GetAttr(key uint8) (value string, ok bool)

GetAttr gets an attribute from the Set.

func (Set) IsRegular

func (s Set) IsRegular() bool

IsRegular reports whether the Set is equivalent to its zero value.

func (*Set) SetAttr

func (s *Set) SetAttr(key uint8, value string)

SetAttr adds an attribute to the Set, replacing any existing one of the same key. Keys >= 64 aren't supported yet, and will cause a panic.

Jump to

Keyboard shortcuts

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