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.

@linkmauve linkmauve force-pushed the edition-2021-cstr-literals branch from 77d710e to d0c1d92 Compare June 30, 2024 17:45
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.
@linkmauve linkmauve force-pushed the edition-2021-cstr-literals branch from d0c1d92 to e91165e Compare June 30, 2024 18:17
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.
@linkmauve linkmauve force-pushed the edition-2021-cstr-literals branch from e91165e to fc12195 Compare June 30, 2024 18:28
@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.

@Drakulix
Copy link
Member

Drakulix commented Jan 2, 2025

We bumped the MSRV as part of #1576.

Could you drop 2eac2b2 and rebase this PR?

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.

4 participants