[PATCH 5/6] rust: add `CStr` methods matching `core::ffi::CStr`
Benno Lossin
lossin at kernel.org
Sat Jul 5 09:15:46 UTC 2025
On Fri Jul 4, 2025 at 10:14 PM CEST, Tamir Duberstein wrote:
> Prepare for replacing `CStr` with `core::ffi::CStr` by soft-deprecating
> methods which don't exist on `core::ffi::CStr`.
>
> We could keep `as_bytes{,_with_nul}` through an extension trait but
> seeing as we have to introduce `as_char_ptr_in_const_context` as a free
> function, we may as well introduce `to_bytes{,_with_nul}` here to allow
> downstream code to migrate in one cycle rather than two.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1075
> Signed-off-by: Tamir Duberstein <tamird at gmail.com>
Reviewed-by: Benno Lossin <lossin at kernel.org>
---
Cheers,
Benno
> ---
> rust/kernel/str.rs | 37 ++++++++++++++++++++++++++++++++++---
> 1 file changed, 34 insertions(+), 3 deletions(-)
More information about the dri-devel
mailing list