Source file
src/go/types/chan.go
1
2
3
4
5 package types
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 (t *Chan) Underlying() Type { return t }
35 func (t *Chan) String() string { return TypeString(t, nil) }
36
View as plain text