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

Add support for the bstr crate #112

Closed
wants to merge 3 commits into from
Closed

Add support for the bstr crate #112

wants to merge 3 commits into from

Conversation

TethysSvensson
Copy link
Collaborator

@TethysSvensson TethysSvensson commented Jul 10, 2022

Fixes #110.

Checklist

  • Updated CHANGELOG.md with relevant changes
  • Added tests for any new/fixed functionality
  • Added/updated documentation for new/changed code
  • Checked that README.md still makes sense (and updated it if necessary)

@TethysSvensson
Copy link
Collaborator Author

I have tried splitting up this feature flag into three different ones:

bstr-deserialize = ["dep:bstr"]
bstr-serialize = ["dep:bstr"]
bstr-owned = ["bstr-serialize"]
  • bstr-deserialize would cause the deserialize code to emit &BStr instead of &str.
  • bstr-serialize would allow you to build a Offset<str> from a &BStr/BString.
  • bstr-owned would cause the owned structs for tables/unions to use BString instead of String.

I ran into an issue with the error handling in the TryFrom code that converts Refs into owned structs in the case where only bstr-deserialize was enabled. The problem is that the TryFrom code needs to return a planus::Error and this is hard to do in some cases.

@TethysSvensson
Copy link
Collaborator Author

This PR is very stale. I am also no longer sure this is the right way to do it.

@TethysSvensson TethysSvensson deleted the bstr-support branch November 14, 2022 22:10
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.

[Rust] Consider using bstr for deserialized strings
1 participant