violet/utils/compilable.go

18 lines
406 B
Go
Raw Permalink Normal View History

2023-04-21 03:21:46 +01:00
package utils
2023-04-24 01:35:23 +01:00
// Compilable is an interface for structs with an asynchronous compile method.
2023-04-21 03:21:46 +01:00
type Compilable interface {
Compile()
}
2023-04-24 01:35:23 +01:00
// MultiCompilable is a slice of multiple Compilable interfaces.
2023-04-21 03:21:46 +01:00
type MultiCompilable []Compilable
2023-04-24 01:35:23 +01:00
// Compile loops over the slice of Compilable interfaces and calls Compile on
// each one.
2023-04-21 03:21:46 +01:00
func (m MultiCompilable) Compile() {
for _, i := range m {
i.Compile()
}
}