Source File
constructor.go
Belonging Package
github.com/gotd/td/internal/tmap
package tmap
import
// Constructor maps type id to type constructor.
type Constructor struct {
types map[uint32]func() bin.Object
}
func ( *Constructor) ( map[uint32]func() bin.Object) {
// Probably it is good place to catch collisions, but
// ignoring for now.
for , := range {
.types[] =
}
}
// New instantiates new value for type id or returns nil.
func ( *Constructor) ( uint32) bin.Object {
if == nil || len(.types) == 0 {
return nil
}
:= .types[]
if == nil {
return nil
}
return ()
}
// NewConstructor merges mappings into Constructor.
func ( ...map[uint32]func() bin.Object) *Constructor {
:= &Constructor{
types: map[uint32]func() bin.Object{},
}
for , := range {
.add()
}
return
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |