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

Expose and document read_data_item. #19

Closed
wants to merge 1 commit into from

Conversation

dvc94ch
Copy link

@dvc94ch dvc94ch commented Feb 25, 2019

Hi,

I'm using read_data_item directly and it would be cool if it were public.

pub(crate) fn decode(bytes: Vec<u8>) -> Result<Ipld, IpldError> {
    let mut d = Decoder::from_bytes(bytes);
    let cbor: Cbor = d.read_data_item(None)?;
    cbor_to_ipld(cbor)
}

@BurntSushi
Copy link
Owner

Thanks for reaching out. Unfortunately, this function should definitely never be exported in its current form. It's an internal implementation detail whose correctness is dependent on its parameters (which this PR does not document).

Separate from that, this project is unmaintained. Please see the top of the README: https://github.com/BurntSushi/rust-cbor/blob/master/README.md

@BurntSushi BurntSushi closed this Feb 25, 2019
@dvc94ch
Copy link
Author

dvc94ch commented Feb 25, 2019

The problem with serde-cbor is that it doesn't support tags which is required for encoding/decoding ipld.

@BurntSushi
Copy link
Owner

Yes, I'm aware of the shortcoming. But that doesn't mean I'm going to maintain this. Sorry. You might consider contributing tag support to serde-cbor, or forking it and adding your own. (I don't know whether they've officially blocked tag support on specialization, but you should be able to use a similar hack that this crate uses to support tags in serde.)

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.

None yet

2 participants