On Mon, Aug 19, 2024 at 5:39 PM Michal Rostecki <vadorovsky@xxxxxxxxx> wrote: > > From: Michal Rostecki <vadorovsky@xxxxxxxxx> > > `CStr` became a part of `core` library in Rust 1.75. This change replaces > the custom `CStr` implementation with the one from `core`. > > `core::CStr` behaves generally the same as the removed implementation, > with the following differences: > > - It does not implement `Display`. > - It does not provide `from_bytes_with_nul_unchecked_mut` method. > - It has `as_ptr()` method instead of `as_char_ptr()`, which also returns > `*const c_char`. > > The first two differences are handled by providing the `CStrExt` trait, > with `display()` and `from_bytes_with_nul_unchecked_mut()` methods. > `display()` returns a `CStrDisplay` wrapper, with a custom `Display` > implementation. > > `DerefMut` implementation for `CString` is removed here, as it's not > being used anywhere. > > Signed-off-by: Michal Rostecki <vadorovsky@xxxxxxxxx> A few comments: * I would probably add CStrExt to the kernel prelude. * I would probably remove `from_bytes_with_nul_unchecked_mut` and keep `DerefMut for CString` instead of the other way around. * Perhaps we should remove the `c_str!` macro and use c"" instead? Alice