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

Use CStr literals everywhere possible #1472

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

linkmauve
Copy link
Contributor

@linkmauve linkmauve commented Jun 30, 2024

This addition to the 2021 edition makes it possible to generate a &CStr at compile-time, with no need for unwrap()/expect() or unsafe, making it much more ergonomic to pass to C APIs.

I’ve also modified the SealedString constructors to take a &CStr instead of a CString since it only needs to use it, not keep ownership of it.

This requires to bump the MSRV to 1.77 so I just did.

examples/buffer_test.rs Outdated Show resolved Hide resolved
This is required for c"" CStr literals.
It only uses it to pass it to a syscall, so it doesn’t need ownership of
it.
This addition to the 2021 edition makes it possible to generate a &CStr
at compile-time, with no need for unwrap()/expect() or unsafe, making it
much more ergonomic to pass to C APIs.
@cmeissl
Copy link
Collaborator

cmeissl commented Jul 6, 2024

Thanks, looks good in general. Unfortunately bumping the MSRV is not an option at the moment. I will try to make sure we can do this in the near future, but this has to wait until we are able to bump the MSRV in some projects that depend on smithay.

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.

3 participants