Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 33 for MarshalNext (2.82 sec)

  1. 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)
  2. 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)
  3. 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)
  4. src/crypto/x509/oid_test.go

    			continue
    		}
    
    		if !o2.Equal(tt.out) {
    			t.Errorf("ParseOID(%q) = %v; want = %v", tt.in, o2, tt.out)
    			continue
    		}
    
    		marshalled, err := o.MarshalText()
    		if string(marshalled) != tt.in || err != nil {
    			t.Errorf("(%#v).MarshalText() = (%v, %v); want = (%v, nil)", o, string(marshalled), err, tt.in)
    			continue
    		}
    
    		binary, err := o.MarshalBinary()
    		if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 19:10:38 UTC 2024
    - 10.8K bytes
    - Viewed (0)
  5. src/math/big/floatmarsh.go

    		return errors.New("Float.GobDecode: " + msg)
    	}
    
    	return nil
    }
    
    // MarshalText implements the [encoding.TextMarshaler] interface.
    // Only the [Float] value is marshaled (in full precision), other
    // attributes such as precision or accuracy are ignored.
    func (x *Float) MarshalText() (text []byte, err error) {
    	if x == nil {
    		return []byte("<nil>"), nil
    	}
    	var buf []byte
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:31:58 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  6. internal/kms/conn.go

    	Ciphertext []byte // Ciphertext of the data encryption key
    }
    
    var (
    	_ encoding.TextMarshaler   = (*DEK)(nil)
    	_ encoding.TextUnmarshaler = (*DEK)(nil)
    )
    
    // MarshalText encodes the DEK's key ID and ciphertext
    // as JSON.
    func (d DEK) MarshalText() ([]byte, error) {
    	type JSON struct {
    		KeyID      string `json:"keyid"`
    		Version    uint32 `json:"version,omitempty"`
    		Ciphertext []byte `json:"ciphertext"`
    	}
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue May 07 23:55:37 UTC 2024
    - 5K bytes
    - Viewed (0)
  7. internal/kms/dek_test.go

    		},
    	},
    }
    
    func TestEncodeDecodeDEK(t *testing.T) {
    	for i, test := range dekEncodeDecodeTests {
    		text, err := test.Key.MarshalText()
    		if err != nil {
    			t.Fatalf("Test %d: failed to marshal DEK: %v", i, err)
    		}
    
    		var key DEK
    		if err = key.UnmarshalText(text); err != nil {
    			t.Fatalf("Test %d: failed to unmarshal DEK: %v", i, err)
    		}
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue May 07 23:55:37 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  8. internal/kms/secret-key.go

    // with KES and MinKMS.
    func (s secretKey) GenerateKey(_ context.Context, req *GenerateKeyRequest) (DEK, error) {
    	if req.Name != s.keyID {
    		return DEK{}, ErrKeyNotFound
    	}
    	associatedData, err := req.AssociatedData.MarshalText()
    	if err != nil {
    		return DEK{}, err
    	}
    
    	const randSize = 28
    	random, err := sioutil.Random(randSize)
    	if err != nil {
    		return DEK{}, err
    	}
    	iv, nonce := random[:16], random[16:]
    
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue May 07 23:55:37 UTC 2024
    - 8.2K bytes
    - Viewed (0)
  9. src/encoding/json/encode_test.go

    type RefText int
    
    func (*RefText) MarshalText() ([]byte, error) {
    	return []byte(`"ref"`), nil
    }
    
    func (r *RefText) UnmarshalText([]byte) error {
    	*r = 13
    	return nil
    }
    
    // ValText has Marshaler methods with value receiver.
    type ValText int
    
    func (ValText) MarshalText() ([]byte, error) {
    	return []byte(`"val"`), nil
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 29.4K bytes
    - Viewed (0)
  10. src/net/netip/netip.go

    		ret = append(ret, '%')
    		ret = append(ret, ip.Zone()...)
    	}
    	return string(ret)
    }
    
    // MarshalText implements the [encoding.TextMarshaler] interface,
    // The encoding is the same as returned by [Addr.String], with one exception:
    // If ip is the zero [Addr], the encoding is the empty string.
    func (ip Addr) MarshalText() ([]byte, error) {
    	switch ip.z {
    	case z0:
    		return []byte(""), nil
    	case z4:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 17:10:01 UTC 2024
    - 43.2K bytes
    - Viewed (0)
Back to top