rust: str: implement several traits for `CStr`
authorGary Guo <gary@garyguo.net>
Thu, 10 Nov 2022 16:41:29 +0000 (17:41 +0100)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 4 Dec 2022 00:59:15 +0000 (01:59 +0100)
commitc07e67bd2daf99de923b6fd927ab8c18e0f57b05
treea00b2bf56e96c9ce0598287b2c4142bcb978bc2e
parentd126d2380131dfbc880f5b5f0e3015e9bef6fa1c
rust: str: implement several traits for `CStr`

Implement `Debug`, `Display`, `Deref` (into `BStr`), `AsRef<BStr>`
and a set of `Index<...>` traits.

This makes it `CStr` more convenient to use (and closer to `str`).

Co-developed-by: Alex Gaynor <alex.gaynor@gmail.com>
Signed-off-by: Alex Gaynor <alex.gaynor@gmail.com>
Co-developed-by: Morgan Bartlett <mjmouse9999@gmail.com>
Signed-off-by: Morgan Bartlett <mjmouse9999@gmail.com>
Signed-off-by: Gary Guo <gary@garyguo.net>
[Reworded, adapted for upstream and applied latest changes]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/str.rs