diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-05 10:03:08 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-05 21:01:58 -0700 |
commit | 0ff1d420f21101a92d8da888d491860cf0cf16cc (patch) | |
tree | 3e5715b4e4fd6619f2edddf5bab315cb9a125598 /lib/containers/ordered.go | |
parent | 53d7fbb73869eb5defa1ca5c52b26abd346b13b9 (diff) |
containers: s/Cmp/Compare/ to match the standard library
Go 1.18 added net/netip.Addr.Compare, and Go 1.20 added time.Time.Compare.
Diffstat (limited to 'lib/containers/ordered.go')
-rw-r--r-- | lib/containers/ordered.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/containers/ordered.go b/lib/containers/ordered.go index d918149..aa2c94d 100644 --- a/lib/containers/ordered.go +++ b/lib/containers/ordered.go @@ -1,4 +1,4 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> +// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com> // // SPDX-License-Identifier: GPL-2.0-or-later @@ -9,7 +9,7 @@ import ( ) type _Ordered[T any] interface { - Cmp(T) int + Compare(T) int } type Ordered[T _Ordered[T]] _Ordered[T] @@ -18,7 +18,7 @@ type NativeOrdered[T constraints.Ordered] struct { Val T } -func NativeCmp[T constraints.Ordered](a, b T) int { +func NativeCompare[T constraints.Ordered](a, b T) int { switch { case a < b: return -1 @@ -29,8 +29,8 @@ func NativeCmp[T constraints.Ordered](a, b T) int { } } -func (a NativeOrdered[T]) Cmp(b NativeOrdered[T]) int { - return NativeCmp(a.Val, b.Val) +func (a NativeOrdered[T]) Compare(b NativeOrdered[T]) int { + return NativeCompare(a.Val, b.Val) } var _ Ordered[NativeOrdered[int]] = NativeOrdered[int]{} |