You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
366 B
21 lines
366 B
8 months ago
|
package rpccache
|
||
|
|
||
|
func newListMap[V comparable](values []V, err error) (*listMap[V], error) {
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
lm := &listMap[V]{
|
||
|
List: values,
|
||
|
Map: make(map[V]struct{}, len(values)),
|
||
|
}
|
||
|
for _, value := range values {
|
||
|
lm.Map[value] = struct{}{}
|
||
|
}
|
||
|
return lm, nil
|
||
|
}
|
||
|
|
||
|
type listMap[V comparable] struct {
|
||
|
List []V
|
||
|
Map map[V]struct{}
|
||
|
}
|