Skip to content

Commit

Permalink
internal/state: Make Pair comparable
Browse files Browse the repository at this point in the history
  • Loading branch information
susji committed Apr 8, 2024
1 parent ec42dba commit e0f5dde
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ import (
"golang.org/x/exp/maps"
)

type Pair[T any] struct {
type Pair[T comparable] struct {
Timestamp time.Time
Value T
}

func (p Pair[T]) Equal(p2 Pair[T]) bool {
return p.Value == p2.Value && p.Timestamp.Equal(p2.Timestamp)
}

type Floats map[rawv2.MAC]Pair[float32]
type Uint32s map[rawv2.MAC]Pair[uint32]
type Int16s map[rawv2.MAC]Pair[int16]
Expand Down

0 comments on commit e0f5dde

Please sign in to comment.