github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/c/kv.go (about)

     1  package c
     2  
     3  // KV is the simplest implementation of a key/value pair.
     4  type KV[k any, v any] struct {
     5  	K k
     6  	V v
     7  }
     8  
     9  // Key returns the key
    10  func (k KV[K, V]) Key() K {
    11  	return k.K
    12  }
    13  
    14  // Value returns the value
    15  func (k KV[K, V]) Value() V {
    16  	return k.V
    17  }
    18  
    19  // Get returns the key/value pair
    20  func (k KV[K, V]) Get() (K, V) {
    21  	return k.K, k.V
    22  }