visited

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Visited

type Visited[T comparable] struct {
	// contains filtered or unexported fields
}

Visited is a simple object that tracks whether or not a particular value has been visited. Use this when iterating over a collection and you need to know if a value has been encountered.

CAUTION: Not concurrency safe.

func New

func New[T comparable]() Visited[T]

func (*Visited[T]) Count

func (s *Visited[T]) Count() int

Count returns the number of visited values.

CAUTION: Not concurrency safe.

func (*Visited[T]) PeekVisited

func (s *Visited[T]) PeekVisited(key T) bool

PeekVisited returns true if the value has been visited, false otherwise. It does not add the value to the set of visited values. Use this for use cases where marking the value as visited needs to happen after processing.

CAUTION: Not concurrency safe.

func (*Visited[T]) Visit

func (s *Visited[T]) Visit(key T) bool

Visit returns true if the value has been visited, false otherwise. It also adds the value to the set of visited values.

CAUTION: Not concurrency safe.

Jump to

Keyboard shortcuts

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