mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-12 10:47:05 +02:00
Convenience method to access any member of a set
This commit is contained in:
@@ -73,6 +73,13 @@ func (self *Set[T]) Iterable() map[T]struct{} {
|
||||
return self.items
|
||||
}
|
||||
|
||||
func (self *Set[T]) Any() T {
|
||||
for x := range self.items {
|
||||
return x
|
||||
}
|
||||
panic("set is empty")
|
||||
}
|
||||
|
||||
func (self *Set[T]) AsSlice() []T {
|
||||
return Keys(self.items)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user