Documentation
¶
Index ¶
- type Event
- type Map
- func (s *Map[K, T]) ChangeKey(key, new_key K) (T, bool)
- func (s *Map[K, T]) Clear()
- func (s *Map[K, T]) Clone() *Map[K, T]
- func (s *Map[K, T]) Delete(key K)
- func (s *Map[K, T]) ForEach(fn func(key K, value T) bool)
- func (s *Map[K, T]) Get(key K) (T, bool)
- func (s *Map[K, T]) GetOrSet(key K, value T) (actual T, loaded bool)
- func (s *Map[K, T]) Len() int
- func (s *Map[K, T]) Pop(key K) (T, bool)
- func (s *Map[K, T]) Set(key K, value T)
- type Observable
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event struct containing a state and a pointer to a channel
type Map ¶
type Map[K comparable, T any] struct { // contains filtered or unexported fields }
func NewMap ¶
func NewMap[K comparable, T any]() *Map[K, T]
type Observable ¶
type Observable[T any] struct { // contains filtered or unexported fields }
Observable is a generic structure that represents a value that can be observed.
func NewObservable ¶
func NewObservable[T any](initialValue T) *Observable[T]
NewObservable creates a new Observable with an initial value.
func (*Observable[T]) Get ¶
func (o *Observable[T]) Get() T
Get returns the current value of the observable.
func (*Observable[T]) Len ¶
func (o *Observable[T]) Len() int
Len returns the number of observers currently subscribed.
func (*Observable[T]) Set ¶
func (o *Observable[T]) Set(value T)
Set updates the value of the observable and notifies all observers.
func (*Observable[T]) Subscribe ¶
func (o *Observable[T]) Subscribe(ctx context.Context) <-chan T
Subscribe allows an observer to receive notifications when the value changes.
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
func NewSet ¶
func NewSet[T comparable]() *Set[T]
func (*Set[T]) Add ¶
Adds a key to the set. Returns `true` if the key was added, or `false` if it already existed.
Click to show internal directories.
Click to hide internal directories.