Source file src/go/types/slice.go

     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 types
     6  
     7  // A Slice represents a slice type.
     8  type Slice struct {
     9  	elem Type
    10  }
    11  
    12  // NewSlice returns a new slice type for the given element type.
    13  func NewSlice(elem Type) *Slice { return &Slice{elem: elem} }
    14  
    15  // Elem returns the element type of slice s.
    16  func (s *Slice) Elem() Type { return s.elem }
    17  
    18  func (t *Slice) Underlying() Type { return t }
    19  func (t *Slice) String() string   { return TypeString(t, nil) }
    20  

View as plain text