From f4e66b0804d32e8880cf1bb27db1cdbe44c01e72 Mon Sep 17 00:00:00 2001 From: Austin Ely Date: Tue, 3 Oct 2023 13:25:32 -0400 Subject: [PATCH] chore: example to Lesser struct --- internal/pkg/queue/queue.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/pkg/queue/queue.go b/internal/pkg/queue/queue.go index 4d4b46df606..5d37c12c22a 100644 --- a/internal/pkg/queue/queue.go +++ b/internal/pkg/queue/queue.go @@ -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 }