github.com/vugu/vugu@v0.3.6-0.20240430171613-3f6f402e014b/comp-key-default.go (about)

     1  // +build !tinygo
     2  
     3  package vugu
     4  
     5  // CompKey is the key used to identify and look up a component instance.
     6  type CompKey struct {
     7  	ID      uint64      // unique ID for this instance of a component, randomly generated and embeded into source code
     8  	IterKey interface{} // optional iteration key to distinguish the same component reference in source code but different loop iterations
     9  }
    10  
    11  // MakeCompKey creates a CompKey from the id and iteration key you provide.
    12  // The purpose is to hide the implementation of CompKey as it can vary.
    13  func MakeCompKey(id uint64, iterKey interface{}) CompKey {
    14  	return CompKey{ID: id, IterKey: iterKey}
    15  }