github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/types2/chan.go (about)

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