Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 401 for u8marshal (0.15 sec)

  1. src/encoding/json/decode_test.go

    type ustructText struct {
    	M unmarshalerText
    }
    
    // u8marshal is an integer type that can marshal/unmarshal itself.
    type u8marshal uint8
    
    func (u8 u8marshal) MarshalText() ([]byte, error) {
    	return []byte(fmt.Sprintf("u%d", u8)), nil
    }
    
    var errMissingU8Prefix = errors.New("missing 'u' prefix")
    
    func (u8 *u8marshal) UnmarshalText(b []byte) error {
    	if !bytes.HasPrefix(b, []byte{'u'}) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 11 16:40:14 UTC 2024
    - 67.6K bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/unmarshal/unmarshal.go

    		}
    
    		// Classify the callee (without allocating memory).
    		argidx := -1
    
    		recv := fn.Type().(*types.Signature).Recv()
    		if fn.Name() == "Unmarshal" && recv == nil {
    			// "encoding/json".Unmarshal
    			// "encoding/xml".Unmarshal
    			// "encoding/asn1".Unmarshal
    			switch fn.Pkg().Path() {
    			case "encoding/json", "encoding/xml", "encoding/asn1":
    				argidx = 1 // func([]byte, interface{})
    			}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 3.1K bytes
    - Viewed (0)
  3. pkg/util/protomarshal/protomarshal.go

    	strictUnmarshaler = jsonpb.Unmarshaler{}
    )
    
    func Unmarshal(b []byte, m proto.Message) error {
    	return strictUnmarshaler.Unmarshal(bytes.NewReader(b), legacyproto.MessageV1(m))
    }
    
    func UnmarshalString(s string, m proto.Message) error {
    	return Unmarshal([]byte(s), m)
    }
    
    func UnmarshalAllowUnknown(b []byte, m proto.Message) error {
    	return unmarshaler.Unmarshal(bytes.NewReader(b), legacyproto.MessageV1(m))
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Mar 12 10:02:09 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  4. 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)
  5. src/internal/chacha8rand/chacha8.go

    				break
    			}
    			s.Refill()
    		}
    	}
    	s.Init64(seed)
    }
    
    // Marshal marshals the state into a byte slice.
    // Marshal and Unmarshal are functions, not methods,
    // so that they will not be linked into the runtime
    // when it uses the State struct, since the runtime
    // does not need these.
    func Marshal(s *State) []byte {
    	data := make([]byte, 6*8)
    	copy(data, "chacha8:")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:47:29 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  6. 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)
  7. 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)
  8. staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/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 := Time{}
    		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:09 UTC 2024
    - 9.4K bytes
    - Viewed (0)
  9. pkg/model/proxy_test.go

    		t.Run(tt.name, func(t *testing.T) {
    			j, err := json.Marshal(tt.in)
    			if err != nil {
    				t.Fatalf("failed to marshal: %v", err)
    			}
    			if string(j) != tt.out {
    				t.Errorf("Got json '%s', expected '%s'", string(j), tt.out)
    			}
    			var meta model.BootstrapNodeMetadata
    			if err := json.Unmarshal(j, &meta); err != nil {
    				t.Fatalf("failed to unmarshal: %v", err)
    			}
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Mar 28 20:38:02 UTC 2024
    - 8.2K bytes
    - Viewed (0)
  10. src/crypto/tls/handshake_messages.go

    // since their wire representation is idempotent. For clientHelloMsg and
    // serverHelloMsg, we store the original wire representation of the message and
    // use that for hashing, since unmarshal/marshal are not idempotent due to
    // extension ordering and other malleable fields, which may cause differences
    // between what was received and what we marshal.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:10:12 UTC 2024
    - 51.8K bytes
    - Viewed (0)
Back to top