Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 199 for SLICE (0.12 sec)

  1. src/go/types/slice.go

    // Source: ../../cmd/compile/internal/types2/slice.go
    
    // Copyright 2011 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 types
    
    // A Slice represents a slice type.
    type Slice struct {
    	elem Type
    }
    
    // NewSlice returns a new slice type for the given element type.
    func NewSlice(elem Type) *Slice { return &Slice{elem: elem} }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 701 bytes
    - Viewed (0)
  2. pkg/apis/resource/validation/validation_resourceslice_test.go

    				return slice
    			}(),
    		},
    		"resource-version": {
    			slice: func() *resource.ResourceSlice {
    				slice := testResourceSlice(goodName, goodName, driverName)
    				slice.ResourceVersion = "1"
    				return slice
    			}(),
    		},
    		"generation": {
    			slice: func() *resource.ResourceSlice {
    				slice := testResourceSlice(goodName, goodName, driverName)
    				slice.Generation = 100
    				return slice
    			}(),
    		},
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 14 17:07:36 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  3. src/slices/iter.go

    // returns the extended slice.
    func AppendSeq[Slice ~[]E, E any](s Slice, seq iter.Seq[E]) Slice {
    	for v := range seq {
    		s = append(s, v)
    	}
    	return s
    }
    
    // Collect collects values from seq into a new slice and returns it.
    func Collect[E any](seq iter.Seq[E]) []E {
    	return AppendSeq([]E(nil), seq)
    }
    
    // Sorted collects values from seq into a new slice, sorts the slice,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:40:32 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  4. src/encoding/gob/decgen.go

    		if state.b.Len() == 0 {
    			errorf("decoding %[1]s array or slice: length exceeds input size (%%d elements)", length)
    		}
    		if i >= len(slice) {
    			// This is a slice that we only partially allocated.
    			growSlice(v, &slice, length)
    		}
    		%[3]s
    	}
    	return true
    }
    `
    
    const trailer = `
    // growSlice is called for a slice that we only partially allocated,
    // to grow it up to length.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 20 14:15:38 UTC 2024
    - 5.3K bytes
    - Viewed (0)
  5. pkg/registry/resource/resourceslice/strategy_test.go

    	ctx := genericapirequest.NewDefaultContext()
    	slice := slice.DeepCopy()
    
    	Strategy.PrepareForCreate(ctx, slice)
    	errs := Strategy.Validate(ctx, slice)
    	if len(errs) != 0 {
    		t.Errorf("unexpected error validating for create %v", errs)
    	}
    }
    
    func TestClassStrategyUpdate(t *testing.T) {
    	t.Run("no-changes-okay", func(t *testing.T) {
    		ctx := genericapirequest.NewDefaultContext()
    		slice := slice.DeepCopy()
    		newClass := slice.DeepCopy()
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 14 17:07:36 UTC 2024
    - 2.3K bytes
    - Viewed (0)
  6. src/internal/reflectlite/swapper.go

    // slice.
    //
    // Swapper panics if the provided interface is not a slice.
    func Swapper(slice any) func(i, j int) {
    	v := ValueOf(slice)
    	if v.Kind() != Slice {
    		panic(&ValueError{Method: "Swapper", Kind: v.Kind()})
    	}
    	// Fast path for slices of size 0 and 1. Nothing to swap.
    	switch v.Len() {
    	case 0:
    		return func(i, j int) { panic("reflect: slice index out of range") }
    	case 1:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:30 UTC 2024
    - 2K bytes
    - Viewed (0)
  7. doc/next/6-stdlib/3-iter.md

    - [All](/pkg/slices#All) returns an iterator over slice indexes and values.
    - [Values](/pkg/slices#Values) returns an iterator over slice elements.
    - [Backward](/pkg/slices#Backward) returns an iterator that loops over
      a slice backward.
    - [Collect](/pkg/slices#Collect) collects values from an iterator into
      a new slice.
    - [AppendSeq](/pkg/slices#AppendSeq) appends values from an iterator to
      an existing slice.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 18:34:13 UTC 2024
    - 1.4K bytes
    - Viewed (0)
  8. src/reflect/swapper.go

    // slice.
    //
    // Swapper panics if the provided interface is not a slice.
    func Swapper(slice any) func(i, j int) {
    	v := ValueOf(slice)
    	if v.Kind() != Slice {
    		panic(&ValueError{Method: "Swapper", Kind: v.Kind()})
    	}
    	// Fast path for slices of size 0 and 1. Nothing to swap.
    	switch v.Len() {
    	case 0:
    		return func(i, j int) { panic("reflect: slice index out of range") }
    	case 1:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:30 UTC 2024
    - 2K bytes
    - Viewed (0)
  9. pkg/slices/slices.go

    }
    
    // SortFunc sorts the slice x in ascending order as determined by the less function.
    // This sort is not guaranteed to be stable.
    // The slice is modified in place but returned.
    func SortFunc[E any](x []E, less func(a, b E) int) []E {
    	if len(x) <= 1 {
    		return x
    	}
    	slices.SortFunc(x, less)
    	return x
    }
    
    // SortStableFunc sorts the slice x while keeping the original order of equal element.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed May 15 06:28:11 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  10. pkg/registry/resource/resourceslice/strategy.go

    }
    
    func nodeNameIndexFunc(obj interface{}) ([]string, error) {
    	slice, ok := obj.(*resource.ResourceSlice)
    	if !ok {
    		return nil, fmt.Errorf("not a ResourceSlice")
    	}
    	return []string{slice.NodeName}, nil
    }
    
    // GetAttrs returns labels and fields of a given object for filtering purposes.
    func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {
    	slice, ok := obj.(*resource.ResourceSlice)
    	if !ok {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 07 21:22:55 UTC 2024
    - 4.4K bytes
    - Viewed (0)
Back to top