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

RFE: Intern C-FFI compatible strings #39

Open
dralley opened this issue Dec 9, 2021 · 1 comment
Open

RFE: Intern C-FFI compatible strings #39

dralley opened this issue Dec 9, 2021 · 1 comment

Comments

@dralley
Copy link

dralley commented Dec 9, 2021

I have a project for which I will eventually (probably) want to provide C bindings. It would be enormously convenient if there was a variant of (or feature flag for) the string interner backend which left an extra null-termination byte at the end of every interned string, such that the str_from_interner.as_ptr() could be used from C without first copying the whole string to a new CString.

Is this possible, or am I missing some details which might make this unsafe to do?

@Robbepop
Copy link
Owner

Robbepop commented Dec 9, 2021

That's a decent request and it may make sense to adjust the string_interner crate in order to support this use case.
It is more a question about a proper API design for this issue.
Is there a specific API that you'd like to see as a string_interner user?

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

No branches or pull requests

2 participants