Skip to content

Commit

Permalink
chore: example to Lesser struct
Browse files Browse the repository at this point in the history
  • Loading branch information
bvtujo committed Oct 3, 2023
1 parent 17fcd6d commit f4e66b0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/pkg/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ package queue
import "container/heap"

// Lesser is an interface to enable generic structs to be elements of a priority queue.
// Any struct can become a priority queue element by defining the LessThan method
// and initializing a new PriorityQueue.
//
// (s myStruct) LessThan(other myStruct) bool
// q := NewPriorityQueue[myStruct]()
type Lesser[T any] interface {
LessThan(T) bool
}
Expand Down

0 comments on commit f4e66b0

Please sign in to comment.