cbor icon indicating copy to clipboard operation
cbor copied to clipboard

Implement `de::from_slice_count`

Open ericmarkmartin opened this issue 4 years ago • 4 comments
trafficstars

Add a function that deserializes first valid cbor value out of a slice of bytes and returns the number of consumed bytes.

ericmarkmartin avatar Mar 31 '21 01:03 ericmarkmartin

@firstyear and I would really like this functionality for our work in kanidm/webauthn-rs, where we need to parse cbor values out of byte streams.

ericmarkmartin avatar Mar 31 '21 01:03 ericmarkmartin

I'm also somewhat curious about why I have to subtract one off of the error's offset.

ericmarkmartin avatar Mar 31 '21 01:03 ericmarkmartin

Is there somewhere within the serde_cbor codebase where this could be added as an example usage?

Firstyear avatar Mar 31 '21 03:03 Firstyear

Is there somewhere within the serde_cbor codebase where this could be added as an example usage?

Maybe in from_slice? @dtolnay, would you accept a PR adding such an example to the doc string?

ericmarkmartin avatar Apr 06 '21 18:04 ericmarkmartin