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

feat: Introduce IntoCStr trait #25

Merged
merged 2 commits into from
Jan 16, 2023
Merged

feat: Introduce IntoCStr trait #25

merged 2 commits into from
Jan 16, 2023

Conversation

andoriyu
Copy link
Member

@andoriyu andoriyu commented Jan 15, 2023

Make public interface more ergonomic by accepting more than just &str
in public interface.

BREAKING CHANGE: Public interface now uses generic type that implements
IntoCStr instead of &str as its input. Function signatures has
changed, but code should work as is.

BREAKING CHANGE: libnv::insert_strings now takes ownership of the
value and no longer panics if conversion failed. From now on, it will
return first error as a result.

Closes #18

Make public interface more ergonomic by accepting more than just `&str`
in public interface.

BREAKING CHANGE: Public interface now uses generic type that implements
`IntoCStr` instead of `&str` as its input. Fuction signatures has
changed, but code should work as is.

BREAKING CHANGE: `libnv::insert_strings` now takes ownership of the
value and no longer panics if conversion failed. From now on it will
return first error as a result.

Closes #18
@andoriyu andoriyu force-pushed the 18-cstr-in-public-apis branch from 59d103a to ca59913 Compare January 15, 2023 21:55
@andoriyu
Copy link
Member Author

@asomers Is this what you had in mind?

Copy link
Contributor

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is what I had in mind.

src/nvpair.rs Outdated Show resolved Hide resolved
Co-authored-by: Alan Somers <asomers@gmail.com>
@andoriyu andoriyu merged commit ebefb48 into master Jan 16, 2023
@delete-merged-branch delete-merged-branch bot deleted the 18-cstr-in-public-apis branch January 16, 2023 19:32
andoriyu added a commit that referenced this pull request Jan 16, 2023
Make public interface more ergonomic by accepting more than just &str
in public interface.

BREAKING CHANGE: Public interface now uses generic type that implements
IntoCStr instead of &str as its input. Function signatures has
changed, but code should work as is.

BREAKING CHANGE: libnv::insert_strings now takes ownership of the
value and no longer panics if conversion failed. From now on, it will
return first error as a result.

Closes #18
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.

CStr in public APIs
2 participants