github.com/timandy/routine@v1.1.4-0.20240507073150-e4a3e1fe2ba5/thread_local_map_entry.go (about)

     1  package routine
     2  
     3  type entry any
     4  
     5  func entryValue[T any](e entry) T {
     6  	if e == nil {
     7  		var defaultValue T
     8  		return defaultValue
     9  	}
    10  	return e.(T)
    11  }
    12  
    13  func entryAssert[T any](e entry) (T, bool) {
    14  	v, ok := e.(T)
    15  	return v, ok
    16  }