package direct

import "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"

Package direct provides functions for marshaling and unmarshaling between arbitrary Go values and CBOR data, with behavior that is compatible with that of the CBOR serializer. In particular, types that implement cbor.Marshaler and cbor.Unmarshaler should use these functions.

Index

Functions

func Diagnose

func Diagnose(src []byte) (string, error)

Diagnose accepts well-formed CBOR bytes and returns a string representing the same data item in human-readable diagnostic notation (RFC 8949 Section 8). The diagnostic notation is not meant to be parsed.

func Marshal

func Marshal(src any) ([]byte, error)

Marshal serializes a value to CBOR. If there is more than one way to encode the value, it will make the same choice as the CBOR implementation of runtime.Serializer.

func Unmarshal

func Unmarshal(src []byte, dst any) error

Unmarshal deserializes from CBOR into an addressable value. If there is more than one way to unmarshal a value, it will make the same choice as the CBOR implementation of runtime.Serializer.

Source Files

direct.go

Version
v0.35.3
Published
Dec 4, 2025
Platform
darwin/amd64
Imports
1 packages
Last checked
10 minutes ago

Tools for package owners.