String repr for Set
This commit is contained in:
parent
57839b4e03
commit
12c8af60dc
@ -4,6 +4,8 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
var _ = fmt.Print
|
||||
@ -22,6 +24,10 @@ func (self *Set[T]) AddItems(val ...T) {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *Set[T]) String() string {
|
||||
return fmt.Sprintf("%#v", maps.Keys(self.items))
|
||||
}
|
||||
|
||||
func (self *Set[T]) Remove(val T) {
|
||||
delete(self.items, val)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user