Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 367 for u8marshal (0.19 sec)

  1. src/encoding/xml/marshal.go

    const (
    	// Header is a generic XML header suitable for use with the output of [Marshal].
    	// This is not automatically added to any output of this package,
    	// it is provided as a convenience.
    	Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
    )
    
    // Marshal returns the XML encoding of v.
    //
    // Marshal handles an array or slice by marshaling each of the elements.
    // Marshal handles a pointer by marshaling the value it points at or, if the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 18:46:41 UTC 2024
    - 31.2K bytes
    - Viewed (0)
  2. src/encoding/asn1/marshal.go

    		tag = *params.tag
    	}
    
    	t.tag = bytesEncoder(appendTagAndLength(t.scratch[:0], tagAndLength{class, tag, bodyLen, isCompound}))
    
    	return t, nil
    }
    
    // Marshal returns the ASN.1 encoding of val.
    //
    // In addition to the struct tags recognized by Unmarshal, the following can be
    // used:
    //
    //	ia5:         causes strings to be marshaled as ASN.1, IA5String values
    //	omitempty:   causes empty slices to be skipped
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 17.1K bytes
    - Viewed (0)
  3. src/encoding/json/bench_test.go

    		var f float64
    		for pb.Next() {
    			if err := Unmarshal(data, &f); err != nil {
    				b.Fatalf("Unmarshal error: %v", err)
    			}
    		}
    	})
    }
    
    func BenchmarkUnmarshalInt64(b *testing.B) {
    	b.ReportAllocs()
    	data := []byte(`3`)
    	b.RunParallel(func(pb *testing.PB) {
    		var x int64
    		for pb.Next() {
    			if err := Unmarshal(data, &x); err != nil {
    				b.Fatalf("Unmarshal error: %v", err)
    			}
    		}
    	})
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 15:00:17 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_test.go

    	for _, c := range cases {
    		input := c.input
    		data, err := input.Marshal()
    		if err != nil {
    			t.Fatalf("Failed to marshal input: '%v': %v", input, err)
    		}
    		time := MicroTime{}
    		if err := time.Unmarshal(data); err != nil {
    			t.Fatalf("Failed to unmarshal output: '%v': %v", input, err)
    		}
    		if !reflect.DeepEqual(input, time) {
    			t.Errorf("Marshal->Unmarshal is not idempotent: '%v' vs '%v'", input, time)
    		}
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 21:48:10 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  5. src/crypto/elliptic/elliptic_test.go

    		t.Errorf("IsOnCurve(∞) == true")
    	}
    
    	if xx, yy := Unmarshal(curve, Marshal(curve, x0, y0)); xx != nil || yy != nil {
    		t.Errorf("Unmarshal(Marshal(∞)) did not return an error")
    	}
    	// We don't test UnmarshalCompressed(MarshalCompressed(∞)) because there are
    	// two valid points with x = 0.
    	if xx, yy := Unmarshal(curve, []byte{0x00}); xx != nil || yy != nil {
    		t.Errorf("Unmarshal(∞) did not return an error")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 27 02:00:03 UTC 2023
    - 11.6K bytes
    - Viewed (0)
  6. src/encoding/asn1/marshal_test.go

    	// a, b, c, aa, bb, cc
    
    	output, err := Marshal(testStruct)
    	if err != nil {
    		t.Errorf("%v", err)
    	}
    
    	expectedOrder := []string{"a", "b", "c", "aa", "bb", "cc"}
    	var resultStruct struct {
    		Strings []string `asn1:"set"`
    	}
    	rest, err := Unmarshal(output, &resultStruct)
    	if err != nil {
    		t.Errorf("%v", err)
    	}
    	if len(rest) != 0 {
    		t.Error("Unmarshal returned extra garbage")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 10K bytes
    - Viewed (0)
  7. pkg/kube/inject/template.go

    	if m == nil {
    		return "{}"
    	}
    
    	ba, err := json.Marshal(m)
    	if err != nil {
    		log.Warnf("Unable to marshal %v", m)
    		return "{}"
    	}
    
    	return string(ba)
    }
    
    func fromJSON(j string) any {
    	var m any
    	err := json.Unmarshal([]byte(j), &m)
    	if err != nil {
    		log.Warnf("Unable to unmarshal %s", j)
    		return "{}"
    	}
    
    	return m
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Nov 16 02:12:03 UTC 2023
    - 9.9K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apimachinery/pkg/util/yaml/decoder.go

    	case *map[string]interface{}:
    		if err := yaml.Unmarshal(data, v, preserveIntFloat); err != nil {
    			return err
    		}
    		return jsonutil.ConvertMapNumbers(*v, 0)
    	case *[]interface{}:
    		if err := yaml.Unmarshal(data, v, preserveIntFloat); err != nil {
    			return err
    		}
    		return jsonutil.ConvertSliceNumbers(*v, 0)
    	case *interface{}:
    		if err := yaml.Unmarshal(data, v, preserveIntFloat); err != nil {
    			return err
    		}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 19 21:24:36 UTC 2021
    - 10.2K bytes
    - Viewed (0)
  9. src/encoding/json/stream_test.go

    	err := Unmarshal([]byte(want), &data)
    	if err != nil {
    		t.Fatalf("Unmarshal error: %v", err)
    	}
    	if string([]byte(data.Id)) != raw {
    		t.Fatalf("Unmarshal:\n\tgot:  %s\n\twant: %s", []byte(data.Id), raw)
    	}
    	got, err := Marshal(&data)
    	if err != nil {
    		t.Fatalf("Marshal error: %v", err)
    	}
    	if string(got) != want {
    		t.Fatalf("Marshal:\n\tgot:  %s\n\twant: %s", got, want)
    	}
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Aug 25 16:00:37 UTC 2023
    - 12.9K bytes
    - Viewed (0)
  10. src/encoding/json/decode.go

    // the JSON being the JSON literal null. In that case, Unmarshal sets
    // the pointer to nil. Otherwise, Unmarshal unmarshals the JSON into
    // the value pointed at by the pointer. If the pointer is nil, Unmarshal
    // allocates a new value for it to point to.
    //
    // To unmarshal JSON into a value implementing [Unmarshaler],
    // Unmarshal calls that value's [Unmarshaler.UnmarshalJSON] method, including
    // when the input is a JSON null.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:18:55 UTC 2024
    - 35.3K bytes
    - Viewed (0)
Back to top