github.com/bir3/gocompiler@v0.9.2202/src/go/types/chan.go (about)

     1  // Code generated by "go test -run=Generate -write=all"; DO NOT EDIT.
     2  
     3  // Copyright 2011 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package types
     8  
     9  // A Chan represents a channel type.
    10  type Chan struct {
    11  	dir  ChanDir
    12  	elem Type
    13  }
    14  
    15  // A ChanDir value indicates a channel direction.
    16  type ChanDir int
    17  
    18  // The direction of a channel is indicated by one of these constants.
    19  const (
    20  	SendRecv ChanDir = iota
    21  	SendOnly
    22  	RecvOnly
    23  )
    24  
    25  // NewChan returns a new channel type for the given direction and element type.
    26  func NewChan(dir ChanDir, elem Type) *Chan {
    27  	return &Chan{dir: dir, elem: elem}
    28  }
    29  
    30  // Dir returns the direction of channel c.
    31  func (c *Chan) Dir() ChanDir { return c.dir }
    32  
    33  // Elem returns the element type of channel c.
    34  func (c *Chan) Elem() Type { return c.elem }
    35  
    36  func (c *Chan) Underlying() Type { return c }
    37  func (c *Chan) String() string   { return TypeString(c, nil) }