Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for MyStruct (0.15 sec)

  1. 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)
  2. 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)
  3. 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)
  4. test/typeparam/issue51219.dir/a.go

    package a
    
    // Type I is the first basic test for the issue, which relates to a type that is recursive
    // 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)
  5. src/sort/sort_slices_benchmark_test.go

    	structs := make([]*myStruct, n)
    	for i := 0; i < n; i++ {
    		structs[i] = &myStruct{n: r.IntN(n)}
    	}
    	return structs
    }
    
    func TestStructSorts(t *testing.T) {
    	ss := makeRandomStructs(200)
    	ss2 := make([]*myStruct, len(ss))
    	for i := range ss {
    		ss2[i] = &myStruct{n: ss[i].n}
    	}
    
    	Sort(ss)
    	slices.SortFunc(ss2, func(a, b *myStruct) int { return a.n - b.n })
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 08 22:59:40 UTC 2024
    - 4K bytes
    - Viewed (0)
  6. 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)
  7. 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)
  8. test/fixedbugs/issue24547.go

    // based on the promoted method, not the shadowed method.
    
    package main
    
    import (
    	"bytes"
    	"fmt"
    )
    
    type mystruct struct {
    	f int
    }
    
    func (t mystruct) String() string {
    	return "FAIL"
    }
    
    func main() {
    	type deep struct {
    		mystruct
    	}
    	s := struct {
    		deep
    		*bytes.Buffer
    	}{
    		deep{},
    		bytes.NewBufferString("ok"),
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 27 18:56:36 UTC 2018
    - 757 bytes
    - Viewed (0)
  9. src/internal/types/testdata/examples/functions.go

    	_ = s1
    
    	type myStruct struct{x int}
    	var s2 myStruct
    	g3(nil, struct{x int}{}, myStruct{})
    	g3(&s2, struct{x int}{}, myStruct{})
    	g3(nil, myStruct{}, struct{x int}{})
    	g3(&s2, myStruct{}, struct{x int}{})
    }
    
    // Here's a realistic example.
    
    func append[T any](s []T, t ...T) []T { panic(0) }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 30 20:19:38 UTC 2023
    - 5.5K bytes
    - Viewed (0)
  10. test/abi/convT64_criteria.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package main
    
    import (
    	"fmt"
    )
    
    type MyStruct struct {
    	F0 [0]float64
    	F1 byte
    	F2 int16
    	_  struct {
    		F0 uint32
    	}
    }
    
    func main() {
    	p0 := MyStruct{F0: [0]float64{}, F1: byte(27), F2: int16(9887)}
    	fmt.Println(p0)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 08 17:44:21 UTC 2021
    - 387 bytes
    - Viewed (0)
Back to top