Pair

package
v0.2.37 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pair

type Pair[A any, B any] struct {
	// The first value.
	First A

	// The second value.
	Second B
}

Pair is a pair of values.

func NewPair

func NewPair[A any, B any](first A, second B) *Pair[A, B]

NewPair creates a new pair.

Parameters:

  • first: The first value.
  • second: The second value.

Returns:

  • Pair[A, B]: The new pair.

func (*Pair[A, B]) Clean

func (p *Pair[A, B]) Clean()

Clean cleans the pair by first calling the intf.Clean() function on both the first and second values and then setting them to their zero values.

func (*Pair[A, B]) Copy

func (p *Pair[A, B]) Copy() intf.Copier

Copy returns a shallow or deep copy of the pair according to the function intf.CopyOf().

Returns:

  • intf.Copier: A shallow or deep copy of the pair.

func (*Pair[A, B]) Equals

func (p *Pair[A, B]) Equals(other *Pair[A, B]) bool

Equals returns true if the pair is equal to the other pair according to the function intf.EqualOf().

Parameters:

  • other: The other pair to compare to.

Returns:

  • bool: True if the pair is equal to the other pair.

func (*Pair[A, B]) String

func (p *Pair[A, B]) String() string

String returns a string in the following format: (first, second). Here, both first and second are determined by the intf.StringOf() function.

Returns:

  • string: The string representation of the pair.

Jump to

Keyboard shortcuts

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