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

Make it easier to only parse CBOR once for use case of validation + deserialization #216

Open
itamarst opened this issue Jan 24, 2024 · 0 comments · May be fixed by #217
Open

Make it easier to only parse CBOR once for use case of validation + deserialization #216

itamarst opened this issue Jan 24, 2024 · 0 comments · May be fixed by #217

Comments

@itamarst
Copy link
Contributor

itamarst commented Jan 24, 2024

Due to some issues with the Python cbor2 library, I decided to add deserialization support to pycddl. My prototype works great, and will hopefully release this soon.

The issue is that currently I need to parse the CBOR twice, or clone the parsed value resulting in extra memory usage, because:

  1. cddl::validator::cbor::CBORValidator takes ownership of the ciborium::cbor::Value.
  2. There is no way to extract that value back out once validation is over.

This should be solvable by adding a method to CBORValidator that takes self and returns the Value back out. If you have a specific way you'd prefer this done (extract_value()? impl From<CBORValidator> for ciborium::cbor::Value?) let me know, I can submit a PR either way. Or I'll just choose one if you don't have an opinion.

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 a pull request may close this issue.

1 participant