Search Options

Results per page
Sort
Preferred Languages
Advance

Results 71 - 80 of 94 for NumField (0.36 sec)

  1. src/reflect/value.go

    		return Value{}
    	}
    	m, ok := toRType(v.typ()).MethodByName(name)
    	if !ok {
    		return Value{}
    	}
    	return v.Method(m.Index)
    }
    
    // NumField returns the number of fields in the struct v.
    // It panics if v's Kind is not [Struct].
    func (v Value) NumField() int {
    	v.mustBe(Struct)
    	tt := (*structType)(unsafe.Pointer(v.typ()))
    	return len(tt.Fields)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 21:17:41 UTC 2024
    - 119.9K bytes
    - Viewed (0)
  2. pkg/api/v1/pod/util_test.go

    		// ObjectMeta is generic and therefore should never have a field with a specific resource's name;
    		// it contains cycles so it's easiest to just skip it.
    		if name == "ObjectMeta" {
    			break
    		}
    		for i := 0; i < tp.NumField(); i++ {
    			field := tp.Field(i)
    			resourcePaths.Insert(sets.List[string](collectResourcePaths(t, resourcename, path.Child(field.Name), field.Name, field.Type))...)
    		}
    	case reflect.Interface:
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Sep 25 11:04:08 UTC 2023
    - 32.1K bytes
    - Viewed (0)
  3. src/encoding/binary/binary_test.go

    			ts := T{}
    			if _, err := enc.fn(BigEndian, ts); err == nil {
    				t.Errorf("WriteT: have err == nil, want non-nil")
    			}
    
    			tv := reflect.Indirect(reflect.ValueOf(ts))
    			for i, n := 0, tv.NumField(); i < n; i++ {
    				typ := tv.Field(i).Type().String()
    				if typ == "[4]int" {
    					typ = "int" // the problem is int, not the [4]
    				}
    				if _, err := enc.fn(BigEndian, tv.Field(i).Interface()); err == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 19:16:18 UTC 2024
    - 25.4K bytes
    - Viewed (0)
  4. src/net/http/response_test.go

    	t.Helper()
    	hv := reflect.ValueOf(have).Elem()
    	wv := reflect.ValueOf(want).Elem()
    	if hv.Type() != wv.Type() {
    		t.Errorf("%s: type mismatch %v want %v", prefix, hv.Type(), wv.Type())
    	}
    	for i := 0; i < hv.NumField(); i++ {
    		name := hv.Type().Field(i).Name
    		if !token.IsExported(name) {
    			continue
    		}
    		hf := hv.Field(i).Interface()
    		wf := wv.Field(i).Interface()
    		if !reflect.DeepEqual(hf, wf) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 19:01:29 UTC 2024
    - 23.6K bytes
    - Viewed (0)
  5. src/encoding/gob/type.go

    		if err != nil {
    			return nil, err
    		}
    		st.init(type0)
    		return st, nil
    
    	case reflect.Struct:
    		st := newStructType(name)
    		types[rt] = st
    		idToTypeSlice[st.id()] = st
    		for i := 0; i < t.NumField(); i++ {
    			f := t.Field(i)
    			if !isSent(&f) {
    				continue
    			}
    			typ := userType(f.Type).base
    			tname := typ.Name()
    			if tname == "" {
    				t := userType(f.Type).base
    				tname = t.String()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 02:00:26 UTC 2024
    - 27.2K bytes
    - Viewed (0)
  6. src/cmd/cgo/internal/test/test.go

    	// There should not be a field named 'y'.
    	var v C.misaligned
    	rt := reflect.TypeOf(&v).Elem()
    	if rt.NumField() != 2 || rt.Field(0).Name != "x" || rt.Field(1).Name != "_" {
    		t.Errorf("unexpected fields in C.misaligned:\n")
    		for i := 0; i < rt.NumField(); i++ {
    			t.Logf("%+v\n", rt.Field(i))
    		}
    	}
    }
    
    // issue 7786
    
    func f() {
    	var x1 *C.typedef_test7786
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 15:50:06 UTC 2024
    - 48.5K bytes
    - Viewed (0)
  7. operator/pkg/translate/translate.go

    		if !util.IsNilOrInvalidValue(vv.Elem()) {
    			errs = util.AppendErrs(errs, t.ProtoToHelmValues(vv.Elem().Interface(), root, path))
    		}
    	case reflect.Struct:
    		scope.Debug("Struct")
    		for i := 0; i < vv.NumField(); i++ {
    			fieldName := vv.Type().Field(i).Name
    			fieldValue := vv.Field(i)
    			scope.Debugf("Checking field %s", fieldName)
    			if a, ok := vv.Type().Field(i).Tag.Lookup("json"); ok && a == "-" {
    				continue
    			}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Feb 12 19:43:09 UTC 2024
    - 36.3K bytes
    - Viewed (0)
  8. pilot/pkg/networking/core/listener_test.go

    	// If this fails, that means new fields have been added to FilterChainMatch, filterChainMatchEqual function needs to be updated.
    	if e.NumField() != 14 {
    		t.Fatalf("Expected 14 fields, got %v. This means we need to update filterChainMatchEqual implementation", e.NumField())
    	}
    }
    
    func TestInboundListener_PrivilegedPorts(t *testing.T) {
    	// Verify that an explicit ingress listener will not bind to privileged ports
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Jun 13 01:56:28 UTC 2024
    - 93.6K bytes
    - Viewed (0)
  9. src/encoding/json/encode.go

    		for _, f := range current {
    			if visited[f.typ] {
    				continue
    			}
    			visited[f.typ] = true
    
    			// Scan f.typ for fields to include.
    			for i := 0; i < f.typ.NumField(); i++ {
    				sf := f.typ.Field(i)
    				if sf.Anonymous {
    					t := sf.Type
    					if t.Kind() == reflect.Pointer {
    						t = t.Elem()
    					}
    					if !sf.IsExported() && t.Kind() != reflect.Struct {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:18:55 UTC 2024
    - 36.2K bytes
    - Viewed (0)
  10. src/cmd/go/internal/list/list.go

    				v := reflect.New(reflect.TypeOf(x).Elem()).Elem() // do is always called with a non-nil pointer.
    				v.Set(reflect.ValueOf(x).Elem())
    				for i := 0; i < v.NumField(); i++ {
    					if !listJsonFields.needAny(v.Type().Field(i).Name) {
    						v.Field(i).SetZero()
    					}
    				}
    				x = v.Interface()
    			}
    			b, err := json.MarshalIndent(x, "", "\t")
    			if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 16 16:56:39 UTC 2024
    - 33.3K bytes
    - Viewed (0)
Back to top