visited

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: AGPL-3.0 Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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