Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 54 for mkstruct (0.14 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. test/abi/convF_criteria.go

    // license that can be found in the LICENSE file.
    
    package main
    
    import "fmt"
    
    type myStruct struct {
    	F0 [0]struct{}
    	F1 float32
    }
    
    type myStruct2 struct {
    	F0 [0]struct{}
    	F1 float32
    	F2 [0]struct{}
    }
    
    func main() {
    	x := myStruct{F1: -1.25}
    	fmt.Println(x)
    	x2 := myStruct2{F1: -7.97}
    	fmt.Println(x2)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 08 19:58:50 UTC 2021
    - 424 bytes
    - Viewed (0)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. test/interface/struct.go

    package main
    
    import "os"
    
    var fail int
    
    func check(b bool, msg string) {
    	if (!b) {
    		println("failure in", msg)
    		fail++
    	}
    }
    
    type I1 interface { Get() int; Put(int) }
    
    type S1 struct { i int }
    func (p S1) Get() int { return p.i }
    func (p S1) Put(i int) { p.i = i }
    
    func f1() {
    	s := S1{1}
    	var i I1 = s
    	i.Put(2)
    	check(i.Get() == 1, "f1 i")
    	check(s.i == 1, "f1 s")
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Feb 19 06:33:41 UTC 2012
    - 2.4K bytes
    - Viewed (0)
Back to top