Skip to content

feature: Add new interface as alternative to existing Marshaler interface #507

@fxamacker

Description

@fxamacker

Currently, cbor.Marshaler interface matches json.Marshaler to make it easier for users familiar with encoding/json package.

type Marshaler interface {
	MarshalCBOR() ([]byte, error)
}

However, this also inherits the limitations from matching those interfaces, as already noted in comments and discussions at:

For example, the proposed new API for encoding/json/v2 includes MarshalerV2 or MarshalerTo, etc.

Similarly for this library, a new alternative to Marshaler interface can address known limitations of the old API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions