github.com/15mga/kiwi@v0.0.2-0.20240324021231-b95d5c3ac751/ds/id_link.go (about)

     1  package ds
     2  
     3  func NewIdLink[KT comparable, VT any]() *IdLink[KT, VT] {
     4  	return &IdLink[KT, VT]{}
     5  }
     6  
     7  type IdLink[KT comparable, VT any] struct {
     8  	id KT
     9  	Link[VT]
    10  }
    11  
    12  func (q *IdLink[KT, VT]) Id() KT {
    13  	return q.id
    14  }
    15  
    16  func (q *IdLink[KT, VT]) SetId(id KT) {
    17  	q.id = id
    18  }
    19  
    20  func (q *IdLink[KT, VT]) Push(val VT) {
    21  	q.Link.Push(val)
    22  }
    23  
    24  func (q *IdLink[KT, VT]) PopAll() *LinkElem[VT] {
    25  	return q.Link.PopAll()
    26  }