Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 42 for mkstruct (0.46 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. test/typeparam/genembed2.go

    package main
    
    import (
    	"fmt"
    	"sync"
    )
    
    type MyStruct[T any] struct {
    	val T
    }
    
    type Lockable[T any] struct {
    	MyStruct[T]
    	mu sync.Mutex
    }
    
    // Get returns the value stored in a Lockable.
    func (l *Lockable[T]) Get() T {
    	l.mu.Lock()
    	defer l.mu.Unlock()
    	return l.MyStruct.val
    }
    
    // Set sets the value in a Lockable.
    func (l *Lockable[T]) Set(v T) {
    	l.mu.Lock()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 801 bytes
    - Viewed (0)
  8. test/typeparam/issue51219.dir/a.go

    // via a type constraint.  (In this test, I -> IConstraint -> MyStruct -> I.)
    type JsonRaw []byte
    
    type MyStruct struct {
    	x *I[JsonRaw]
    }
    
    type IConstraint interface {
    	JsonRaw | MyStruct
    }
    
    type I[T IConstraint] struct {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 28 14:59:04 UTC 2022
    - 487 bytes
    - Viewed (0)
  9. test/typeparam/issue50109.go

    	return NewAny[T]()
    }
    
    type MyStruct struct {
    	Name string
    }
    
    func main() {
    	// Create a generic cache.
    	// All items are cached as interface{} so they need to be cast back to their
    	// original type when retrieved.
    	// Failure in issue doesn't happen with 'any' replaced by 'interface{}'
    	c := NewAnyCacher[any]()
    
    	myStruct := &MyStruct{"MySuperStruct"}
    
    	c.Set("MySuperStruct", myStruct)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 2.2K bytes
    - Viewed (0)
  10. 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)
Back to top