More refactoring.

This commit is contained in:
Andrey Parhomenko 2023-09-25 20:15:57 +03:00
parent 6480ddf20d
commit 185c8fc1f8
2 changed files with 13 additions and 3 deletions

View file

@ -141,7 +141,4 @@ func (widget *ReplyWidget) Serve(c *Context) {
} }
} }
type DynamicReplyWidget struct {
}

View file

@ -5,6 +5,15 @@ import (
//"fmt" //"fmt"
) )
type Maker[V any] interface {
Make(*Context) V
}
type MakeFunc[V any] func(*Context) V
func (fn MakeFunc[V]) Make(c *Context) V {
return fn(c)
}
type ArgMap = map[string] any type ArgMap = map[string] any
type ArgSlice = []any type ArgSlice = []any
type ArgList[V any] []V type ArgList[V any] []V
@ -20,6 +29,10 @@ type Widget interface {
Serve(*Context) Serve(*Context)
} }
type DynamicWidget[W Widget] interface {
Maker[W]
}
// Implementing the interface provides ability to // Implementing the interface provides ability to
// be used as the root widget for contexts. // be used as the root widget for contexts.
type RootWidget interface { type RootWidget interface {