1
2
3
4
5 package types2
6
7
8 type Chan struct {
9 dir ChanDir
10 elem Type
11 }
12
13
14 type ChanDir int
15
16
17 const (
18 SendRecv ChanDir = iota
19 SendOnly
20 RecvOnly
21 )
22
23
24 func NewChan(dir ChanDir, elem Type) *Chan {
25 return &Chan{dir: dir, elem: elem}
26 }
27
28
29 func (c *Chan) Dir() ChanDir { return c.dir }
30
31
32 func (c *Chan) Elem() Type { return c.elem }
33
34 func (c *Chan) Underlying() Type { return c }
35 func (c *Chan) String() string { return TypeString(c, nil) }
36
View as plain text