| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package confmap // import "go.opentelemetry.io/collector/confmap" |
| 5 |
|
| 6 |
type moduleFactory[T any, S any] interface { |
| 7 |
Create(s S) T |
| 8 |
} |
| 9 |
|
| 10 |
type createConfmapFunc[T any, S any] func(s S) T |
| 11 |
|
| 12 |
type confmapModuleFactory[T any, S any] struct { |
| 13 |
f createConfmapFunc[T, S] |
| 14 |
} |
| 15 |
|
| 16 |
func (c confmapModuleFactory[T, S]) Create(s S) T { |
| 17 |
return c.f(s) |
| 18 |
} |
| 19 |
|
| 20 |
func newConfmapModuleFactory[T, S any](f createConfmapFunc[T, S]) moduleFactory[T, S] { |
| 21 |
return confmapModuleFactory[T, S]{ |
| 22 |
f: f, |
| 23 |
} |
| 24 |
} |