Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: represent CID as enum and not as newtype struct #143

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vmx
Copy link
Member

@vmx vmx commented Feb 25, 2022

Changing from newtype struct to enum should hopefully make things
more robust.

Changing from newtype struct to enum should hopefully make things
more robust.
@vmx vmx requested a review from Stebalien March 1, 2022 10:27
@vmx
Copy link
Member Author

vmx commented Mar 1, 2022

The corresponding change for cbor: vmx/serde_ipld_dagcbor#5

Copy link
Collaborator

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, this seems like it's strictly less likely to get misinterpreted. But the final decision is up to you.

visitor: V,
) -> Result<V::Value, Self::Error> {
let (variant, value) = match self {
if name == CID_SERDE_PRIVATE_IDENTIFIER && variants == [CID_SERDE_PRIVATE_IDENTIFIER] {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible extension: allow the variants to be arbitrary IPLD kinds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants