mirror of
https://github.com/nikdoof/hapz2m.git
synced 2026-01-30 02:18:22 +00:00
Introduce constructors for ExposeMapping
This should allow the ExposeMapping struct to be changed without constantly impacting its callers.
This commit is contained in:
10
z2m.go
10
z2m.go
@@ -242,6 +242,16 @@ type ExposeMapping struct {
|
||||
Translator MappingTranslator
|
||||
}
|
||||
|
||||
// Creates a new ExposeMapping
|
||||
func NewExposeMapping(e *ExposesEntry, c *characteristic.C) *ExposeMapping {
|
||||
return &ExposeMapping{ExposesEntry: e, Characteristic: c}
|
||||
}
|
||||
|
||||
// Creates a new ExposeMapping with a MappingTranslator
|
||||
func NewTranslatedExposeMapping(e *ExposesEntry, c *characteristic.C, t MappingTranslator) *ExposeMapping {
|
||||
return &ExposeMapping{ExposesEntry: e, Characteristic: c, Translator: t}
|
||||
}
|
||||
|
||||
func (m *ExposeMapping) String() string {
|
||||
return fmt.Sprintf("{%q,%s -> ctyp %s}",
|
||||
m.ExposesEntry.Name, m.ExposesEntry.Type, m.Characteristic.Type)
|
||||
|
||||
Reference in New Issue
Block a user