Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 56 for MarshalNext (0.17 sec)

  1. test/typeparam/issue50437.dir/a.go

    func Marshal(in interface{}) (out []byte, err error) {
    	return MarshalOptions{}.Marshal(in)
    }
    
    func (mo MarshalOptions) Marshal(in interface{}) (out []byte, err error) {
    	err = mo.MarshalNext(in)
    	return nil, err
    }
    
    func (mo MarshalOptions) MarshalNext(in interface{}) error {
    	a := new(arshaler)
    	a.marshal = func(MarshalOptions) error { return nil }
    	return a.marshal(mo)
    }
    
    type arshaler struct {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 07 17:55:52 UTC 2022
    - 935 bytes
    - Viewed (0)
  2. src/net/netip/fuzz_test.go

    			}
    
    			if ip.IsValid() && !ip.Is4In6() {
    				buf, err := ip.MarshalText()
    				if err != nil {
    					t.Fatal(err)
    				}
    				buf2, err := stdip.MarshalText()
    				if err != nil {
    					t.Fatal(err)
    				}
    				if !bytes.Equal(buf, buf2) {
    					t.Errorf("Addr.MarshalText() != net.IP.MarshalText(): ip=%q stdip=%q", ip, stdip)
    				}
    				if ip.String() != stdip.String() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 20 23:46:23 UTC 2021
    - 10.5K bytes
    - Viewed (0)
  3. src/log/slog/level.go

    	v.val.Store(int64(l))
    }
    
    func (v *LevelVar) String() string {
    	return fmt.Sprintf("LevelVar(%s)", v.Level())
    }
    
    // MarshalText implements [encoding.TextMarshaler]
    // by calling [Level.MarshalText].
    func (v *LevelVar) MarshalText() ([]byte, error) {
    	return v.Level().MarshalText()
    }
    
    // UnmarshalText implements [encoding.TextUnmarshaler]
    // by calling [Level.UnmarshalText].
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 30 17:34:43 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  4. src/math/big/ratmarsh.go

    	}
    	z.a.neg = b&1 != 0
    	z.a.abs = z.a.abs.setBytes(buf[j:i])
    	z.b.abs = z.b.abs.setBytes(buf[i:])
    	return nil
    }
    
    // MarshalText implements the [encoding.TextMarshaler] interface.
    func (x *Rat) MarshalText() (text []byte, err error) {
    	if x.IsInt() {
    		return x.a.MarshalText()
    	}
    	return x.marshal(), nil
    }
    
    // UnmarshalText implements the [encoding.TextUnmarshaler] interface.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:31:58 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  5. src/encoding/encoding.go

    // marshal itself into a textual form.
    //
    // MarshalText encodes the receiver into UTF-8-encoded text and returns the result.
    type TextMarshaler interface {
    	MarshalText() (text []byte, err error)
    }
    
    // TextUnmarshaler is the interface implemented by an object that can
    // unmarshal a textual representation of itself.
    //
    // UnmarshalText must be able to decode the form generated by MarshalText.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 23 19:43:37 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  6. src/math/big/intmarsh.go

    		return fmt.Errorf("Int.GobDecode: encoding version %d not supported", b>>1)
    	}
    	z.neg = b&1 != 0
    	z.abs = z.abs.setBytes(buf[1:])
    	return nil
    }
    
    // MarshalText implements the [encoding.TextMarshaler] interface.
    func (x *Int) MarshalText() (text []byte, err error) {
    	if x == nil {
    		return []byte("<nil>"), nil
    	}
    	return x.abs.itoa(x.neg, 10), nil
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  7. src/net/netip/netip_pkg_test.go

    	AppendTo([]byte) []byte
    }
    
    // testAppendToMarshal tests that x's AppendTo and MarshalText methods yield the same results.
    // x's MarshalText method must not return an error.
    func testAppendToMarshal(t *testing.T, x appendMarshaler) {
    	t.Helper()
    	m, err := x.MarshalText()
    	if err != nil {
    		t.Fatalf("(%v).MarshalText: %v", x, err)
    	}
    	a := make([]byte, 0, len(m))
    	a = x.AppendTo(a)
    	if !bytes.Equal(m, a) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 02 15:37:19 UTC 2023
    - 9K bytes
    - Viewed (0)
  8. internal/kms/context.go

    // provided when decrypting an encrypted DEK.
    type Context map[string]string
    
    // MarshalText returns a canonical text representation of
    // the Context.
    
    // MarshalText sorts the context keys and writes the sorted
    // key-value pairs as canonical JSON object. The sort order
    // is based on the un-escaped keys. It never returns an error.
    func (c Context) MarshalText() ([]byte, error) {
    	if len(c) == 0 {
    		return []byte{'{', '}'}, nil
    	}
    
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Sun Jan 02 17:15:06 UTC 2022
    - 6K bytes
    - Viewed (0)
  9. internal/kms/kes.go

    // The same context must be provided when the generated
    // key should be decrypted.
    func (c *kesConn) GenerateKey(ctx context.Context, req *GenerateKeyRequest) (DEK, error) {
    	aad, err := req.AssociatedData.MarshalText()
    	if err != nil {
    		return DEK{}, err
    	}
    
    	name := req.Name
    	if name == "" {
    		name = c.defaultKeyID
    	}
    
    	dek, err := c.client.GenerateKey(ctx, name, aad)
    	if err != nil {
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue May 07 23:55:37 UTC 2024
    - 7.1K bytes
    - Viewed (0)
  10. src/log/slog/level_test.go

    		t.Fatal(err)
    	}
    	if got != want {
    		t.Errorf("got %s, want %s", got, want)
    	}
    }
    
    func TestLevelMarshalText(t *testing.T) {
    	want := LevelWarn - 3
    	wantData := []byte("INFO+1")
    	data, err := want.MarshalText()
    	if err != nil {
    		t.Fatal(err)
    	}
    	if !bytes.Equal(data, wantData) {
    		t.Errorf("got %s, want %s", string(data), string(wantData))
    	}
    	var got Level
    	if err := got.UnmarshalText(data); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 20 20:44:14 UTC 2024
    - 4K bytes
    - Viewed (0)
Back to top