Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractFirsts ¶ added in v0.3.0
ExtractFirsts extracts all the first elements from the given slice of pairs.
Parameters:
- pairs: The slice of pairs.
Returns:
- []A: The slice of first elements.
Behaviors:
- If the slice is empty, the function returns nil.
- If the slice contains only nil pairs, the function returns nil.
- This has the side effect of modifying the original slice when at least one nil pair is found. BEWARE!
func ExtractSeconds ¶ added in v0.3.0
ExtractSeconds extracts all the second elements from the given slice of pairs.
Parameters:
- pairs: The slice of pairs.
Returns:
- []B: The slice of second elements.
Behaviors:
- If the slice is empty, the function returns nil.
- If the slice contains only nil pairs, the function returns nil.
- This has the side effect of modifying the original slice when at least one nil pair is found. BEWARE!
Types ¶
type Pair ¶
Pair is a pair of values.
func NewPair ¶
NewPair creates a new pair.
Parameters:
- first: The first value.
- second: The second value.
Returns:
- Pair[A, B]: The new pair.
func RemoveNilPairs ¶ added in v0.3.0
RemoveNilPairs removes all nil pairs from the given slice of pairs.
Parameters:
- pairs: The slice of pairs.
Returns:
- []*Pair[A, B]: The slice of pairs without nil pairs.
Behaviors:
- If the slice is empty, the function returns nil.
- This has the side effect of modifying the original slice when at least one nil pair is found. BEWARE!
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.