Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 31 for mkstruct (0.16 sec)

  1. src/cmd/compile/internal/test/abiutilsaux_test.go

    	field := types.NewField(src.NoXPos, s, t)
    	n := ir.NewNameAt(src.NoXPos, s, t)
    	n.Class = which
    	field.Nname = n
    	return field
    }
    
    // mkstruct is a helper routine to create a struct type with fields
    // of the types specified in 'fieldtypes'.
    func mkstruct(fieldtypes ...*types.Type) *types.Type {
    	fields := make([]*types.Field, len(fieldtypes))
    	for k, t := range fieldtypes {
    		if t == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 13 18:34:00 UTC 2023
    - 3.2K bytes
    - Viewed (0)
  2. src/reflect/internal/example1/example.go

    // Copyright 2021 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package example1
    
    type MyStruct struct {
    	MyStructs []MyStruct
    	MyStruct  *MyStruct
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 09 14:05:53 UTC 2022
    - 246 bytes
    - Viewed (0)
  3. src/sort/sort_slices_benchmark_test.go

    // slices.SortFunc.
    type myStruct struct {
    	a, b, c, d string
    	n          int
    }
    
    type myStructs []*myStruct
    
    func (s myStructs) Len() int           { return len(s) }
    func (s myStructs) Less(i, j int) bool { return s[i].n < s[j].n }
    func (s myStructs) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
    
    func makeRandomStructs(n int) myStructs {
    	r := rand.New(rand.NewPCG(42, 0))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 08 22:59:40 UTC 2024
    - 4K bytes
    - Viewed (0)
  4. src/reflect/internal/example2/example.go

    // Copyright 2021 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package example2
    
    type MyStruct struct {
    	MyStructs []MyStruct
    	MyStruct  *MyStruct
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 09 14:05:53 UTC 2022
    - 246 bytes
    - Viewed (0)
  5. operator/pkg/tpath/struct.go

    		}
    		return getFromStructPath(val.Index(idx).Interface(), path[1:])
    	case reflect.Ptr:
    		structElems = reflect.ValueOf(node).Elem()
    		if !util.IsStruct(structElems) {
    			return nil, false, fmt.Errorf("getFromStructPath path %s, expected struct ptr, got %T", path, node)
    		}
    	default:
    		return nil, false, fmt.Errorf("getFromStructPath path %s, unsupported type %T", path, node)
    	}
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 4.4K bytes
    - Viewed (0)
  6. src/slices/sort_benchmark_test.go

    			}
    		})
    	}
    }
    
    type myStruct struct {
    	a, b, c, d string
    	n          int
    }
    
    func BenchmarkBinarySearchFuncStruct(b *testing.B) {
    	for _, size := range []int{16, 32, 64, 128, 512, 1024} {
    		b.Run(fmt.Sprintf("Size%d", size), func(b *testing.B) {
    			structs := make([]*myStruct, size)
    			for i := range structs {
    				structs[i] = &myStruct{n: i}
    			}
    			midpoint := len(structs) / 2
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 23:39:07 UTC 2024
    - 2.1K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/struct.go

    )
    
    // ----------------------------------------------------------------------------
    // API
    
    // A Struct represents a struct type.
    type Struct struct {
    	fields []*Var   // fields != nil indicates the struct is set up (possibly with len(fields) == 0)
    	tags   []string // field tags; nil if there are no tags
    }
    
    // NewStruct returns a new struct with the given fields and corresponding field tags.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 29 22:06:18 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  8. test/typeparam/struct.go

    // license that can be found in the LICENSE file.
    
    package main
    
    import (
    	"fmt"
    )
    
    type E[T any] struct {
    	v T
    }
    
    type S1 struct {
    	E[int]
    	v string
    }
    
    type Eint = E[int]
    type Ebool = E[bool]
    type Eint2 = Eint
    
    type S2 struct {
    	Eint
    	Ebool
    	v string
    }
    
    type S3 struct {
    	*E[int]
    }
    
    func main() {
    	s1 := S1{Eint{2}, "foo"}
    	if got, want := s1.E.v, 2; got != want {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 05 16:29:58 UTC 2024
    - 801 bytes
    - Viewed (0)
  9. src/go/types/struct.go

    )
    
    // ----------------------------------------------------------------------------
    // API
    
    // A Struct represents a struct type.
    type Struct struct {
    	fields []*Var   // fields != nil indicates the struct is set up (possibly with len(fields) == 0)
    	tags   []string // field tags; nil if there are no tags
    }
    
    // NewStruct returns a new struct with the given fields and corresponding field tags.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 29 22:06:18 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  10. src/internal/types/testdata/check/compliterals.go

    // license that can be found in the LICENSE file.
    
    // Composite literals with parameterized types
    
    package comp_literals
    
    type myStruct struct {
    	f int
    }
    
    type slice[E any] []E
    
    func struct_literals[S struct{f int}|myStruct]() {
    	_ = S{}
    	_ = S{0}
    	_ = S{f: 0}
    
            _ = slice[int]{1, 2, 3}
            _ = slice[S]{{}, {0}, {f:0}}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 02 02:58:32 UTC 2022
    - 442 bytes
    - Viewed (0)
Back to top