set

package
v0.2.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrConflict

type ErrConflict struct {
	Port uint
}

ErrConflict is return when trying to add a port in the set that is already present

func (ErrConflict) Error

func (e ErrConflict) Error() string

type UintSet

type UintSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

UintSet is a set containing uint

func NewUint

func NewUint() *UintSet

NewUint creates a new set for uint

func (*UintSet) Add

func (p *UintSet) Add(i uint) error

Add tries to add port to the set. If port is already present errPortConflict is return otherwise nil is returned

func (*UintSet) List

func (p *UintSet) List() []uint

List returns a list of uint present in the set

func (*UintSet) Remove

func (p *UintSet) Remove(i uint)

Remove removes a port from the set removes never fails cause if the port is not in the set remove is a nop-op

Jump to

Keyboard shortcuts

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