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 compile time macros for CStrs #10

Merged
merged 3 commits into from
Apr 14, 2022
Merged

Add compile time macros for CStrs #10

merged 3 commits into from
Apr 14, 2022

Conversation

lopopolo
Copy link
Member

Add const_assert_bytes_has_no_nul! to assert that a byte slice has no
NUL bytes (either interior or terminating).

Add const_cstr_from_bytes! to construct a &'static CStr from a const
byte slice. A compile time assertion makes sure the invariants of
CStr::from_bytes_with_nul_unchecked are met and then constructs the
CStr from the bytes.

Raise MSRV to 1.59.0 which is when CStr::from_bytes_with_nul_unchecked
became const stable.

Bump crate version to v1.2.0.

Add `const_assert_bytes_has_no_nul!` to assert that a byte slice has no
NUL bytes (either interior or terminating).

Add `const_cstr_from_bytes!` to construct a `&'static CStr` from a const
byte slice. A compile time assertion makes sure the invariants of
`CStr::from_bytes_with_nul_unchecked` are met and then constructs the
`CStr` from the bytes.

Raise MSRV to 1.59.0 which is when `CStr::from_bytes_with_nul_unchecked`
became const stable.

Bump crate version to v1.2.0.
@lopopolo lopopolo added A-macros Area: macro_rules macros. A-release Area: crates.io releases and version bumps. labels Apr 14, 2022
@lopopolo lopopolo force-pushed the lopopolo/cstr-macros branch from b6dfc5a to c41fefe Compare April 14, 2022 01:50
@lopopolo lopopolo merged commit d50931e into trunk Apr 14, 2022
@lopopolo lopopolo deleted the lopopolo/cstr-macros branch April 14, 2022 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: macro_rules macros. A-release Area: crates.io releases and version bumps.
Development

Successfully merging this pull request may close these issues.

1 participant