Documentation ¶
Overview ¶
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 ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diagnose ¶
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 ¶
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.
Note: Support for CBOR is at an alpha stage. If the value (or, for composite types, any of its nested values) implement any of the interfaces encoding.TextMarshaler, encoding.TextUnmarshaler, encoding/json.Marshaler, or encoding/json.Unmarshaler, a non-nil error will be returned unless the value also implements the corresponding CBOR interfaces. This limitation will ultimately be removed in favor of automatic transcoding to CBOR.
func Unmarshal ¶
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.
Note: Support for CBOR is at an alpha stage. If the value (or, for composite types, any of its nested values) implement any of the interfaces encoding.TextMarshaler, encoding.TextUnmarshaler, encoding/json.Marshaler, or encoding/json.Unmarshaler, a non-nil error will be returned unless the value also implements the corresponding CBOR interfaces. This limitation will ultimately be removed in favor of automatic transcoding to CBOR.
Types ¶
This section is empty.